CLASSROOMIO-T-126: Invite teacher and teacher can login

This commit is contained in:
Rotimi Best
2023-09-01 15:28:47 +01:00
parent 9d0fd56f05
commit 929edea63c
29 changed files with 498 additions and 74 deletions
@@ -0,0 +1,24 @@
import { redirect } from '@sveltejs/kit';
import { getCurrentOrg } from '$lib/utils/services/org';
import { getSupabase } from '$lib/utils/functions/supabase';
export const load = async ({ params = { hash: '' } }) => {
try {
const hashData = atob(decodeURIComponent(params.hash));
console.log('hashData', hashData);
const { orgId, email, orgSiteName } = JSON.parse(hashData);
getSupabase();
const _currentOrg = await getCurrentOrg(orgSiteName, true);
return {
orgId,
email,
currentOrg: _currentOrg
};
} catch (error) {
console.error('Error decoding invite params.hash', error);
throw redirect(301, '/404');
}
};