CLASSROOMIO-T-36: Student authentication flow

Co-authored-by: Rotimi Best <rotimiibitoyeemma@gmail.com>

Merge-request: CLASSROOMIO-MR-12
Merged-by: Digdippa Team <digdippa@gmail.com>
This commit is contained in:
Rotimi Best
2023-05-16 04:31:45 +00:00
committed by Space Cloud
co-authored by Rotimi Best
parent 8d0f1e4de1
commit 68e1dbb1b5
12 changed files with 387 additions and 38 deletions
+17 -1
View File
@@ -1,4 +1,5 @@
import get from 'lodash/get';
import { goto } from '@sapper/app';
import { supabase } from '../../functions/supabase';
import { orgs, currentOrg, orgAudience, orgTeam } from '../../store/org';
import { ROLE, ROLE_LABEL } from '../../constants/roles';
@@ -20,6 +21,7 @@ export async function getOrgTeam(orgId) {
`
)
.eq('organization_id', orgId)
.neq('role_id', ROLE.STUDENT)
.order('id', { ascending: false });
const team = [];
@@ -49,7 +51,6 @@ export async function getOrganizations(userId) {
.from('organizationmember')
.select(
`
id,
profile_id,
organization (
id,
@@ -152,3 +153,18 @@ export async function getCourseBySiteName(siteName) {
return data;
}
export async function getCurrentOrg(siteName) {
const { data, error } = await supabase
.from('organization')
.select(`*`)
.eq('siteName', siteName)
.single();
if (error || !data) {
console.error('Error getOrganization', error);
return goto('/404');
}
currentOrg.set(data);
}