Fetch course for CSR
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
<script>
|
||||
import MODES from "../../../../../utils/constants/mode.js";
|
||||
import EditMode from "./EditMode.svelte";
|
||||
import ViewMode from "./ViewMode.svelte";
|
||||
import MODES from '../../../../../utils/constants/mode.js';
|
||||
import EditMode from './EditMode.svelte';
|
||||
import ViewMode from './ViewMode.svelte';
|
||||
|
||||
export let mode = "";
|
||||
export let mode = '';
|
||||
</script>
|
||||
|
||||
{#if mode === MODES.edit}
|
||||
|
||||
@@ -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 };
|
||||
}
|
||||
Reference in New Issue
Block a user