More debuging of route
This commit is contained in:
+18
-10
@@ -9,20 +9,28 @@
|
|||||||
if (process.browser) {
|
if (process.browser) {
|
||||||
console.log('localstorage', localStorage.getItem('supabase.auth.token'));
|
console.log('localstorage', localStorage.getItem('supabase.auth.token'));
|
||||||
}
|
}
|
||||||
|
console.log(`params`, params);
|
||||||
const parsedUser = JSON.parse(params.user);
|
const parsedUser = JSON.parse(params.user);
|
||||||
|
console.log(`parsedUser`, parsedUser);
|
||||||
|
if (parsedUser && parsedUser.id) {
|
||||||
|
const { data: orgMember } = await supabase
|
||||||
|
.from('organizationmember')
|
||||||
|
.select(`organization_id`)
|
||||||
|
.eq('profile_id', parsedUser.id)
|
||||||
|
.single();
|
||||||
|
|
||||||
const { data: orgMember } = await supabase
|
const { data: allCourses } = await supabase
|
||||||
.from('organizationmember')
|
.from('course')
|
||||||
.select(`organization_id`)
|
.select(`id, title, description`)
|
||||||
.eq('profile_id', parsedUser.id)
|
.eq('organization_id', orgMember.organization_id);
|
||||||
.single();
|
|
||||||
|
|
||||||
const { data: allCourses } = await supabase
|
return { allCourses, organizationId: orgMember.organization_id };
|
||||||
.from('course')
|
}
|
||||||
.select(`id, title, description`)
|
|
||||||
.eq('organization_id', orgMember.organization_id);
|
|
||||||
|
|
||||||
return { allCourses, organizationId: orgMember.organization_id };
|
return {
|
||||||
|
allCourses: [],
|
||||||
|
organizationId: null,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user