CLASSROOMIO-T-36: Student authentication flow
Co-authored-by: Rotimi Best <[email protected]> Merge-request: CLASSROOMIO-MR-12 Merged-by: Digdippa Team <[email protected]>
This commit is contained in:
committed by
Space Cloud
co-authored by
Rotimi Best
parent
8d0f1e4de1
commit
68e1dbb1b5
@@ -5,3 +5,19 @@ export function toggleBodyByTheme(isDark) {
|
||||
document.body.className = document.body.className.replace(' dark', '');
|
||||
}
|
||||
}
|
||||
|
||||
export function isCoursesPage(path) {
|
||||
return /courses\/[a-z 0-9 -]/.test(path);
|
||||
}
|
||||
|
||||
export function isCoursePage(path) {
|
||||
return /course\/[a-z 0-9 -]/.test(path);
|
||||
}
|
||||
|
||||
export function isOrgPage(path) {
|
||||
return /org\/[a-z 0-9 -]/.test(path);
|
||||
}
|
||||
|
||||
export function isLMSPage(path) {
|
||||
return /lms[\/a-z 0-9 -]*/.test(path);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user