Fetch course for CSR

This commit is contained in:
rotimi-best
2021-08-21 13:26:43 +03:00
parent 288b342abe
commit 07e8b3a5cb
4 changed files with 48 additions and 27 deletions
+16
View File
@@ -0,0 +1,16 @@
import { supabase } from '../../utils/functions/supabase';
export async function fetchCourses(userId) {
const { data: orgMember } = await supabase
.from('organizationmember')
.select(`organization_id`)
.eq('profile_id', userId)
.single();
const { data: allCourses } = await supabase
.from('course')
.select(`id, title, description`)
.eq('organization_id', orgMember.organization_id);
return { allCourses, organizationId: orgMember.organization_id };
}