diff --git a/package.json b/package.json index c4666656..7686a793 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "scripts": { "dev": "sapper dev", "build": "sapper build --legacy", - "export": "sapper export --legacy --entry \"/ api auth login signup courses dashboard discussions people timetable profile discussions\"", + "export": "sapper export --legacy --entry \"/ login signup courses dashboard discussions people timetable profile discussions\"", "start": "node __sapper__/build" }, "dependencies": { @@ -58,4 +58,4 @@ "tslib": "^2.3.1", "typescript": "^4.1.3" } -} +} \ No newline at end of file diff --git a/src/components/Courses/api.js b/src/components/Courses/api.js index 5dfacca3..8a99c133 100644 --- a/src/components/Courses/api.js +++ b/src/components/Courses/api.js @@ -1,16 +1,13 @@ 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(); +export async function fetchCourses(profileId) { + if (!profileId) return; const { data: allCourses } = await supabase - .from('course') - .select(`id, title, description`) - .eq('organization_id', orgMember.organization_id); + .rpc('get_courses') + .eq('profile_id', profileId); - return { allCourses, organizationId: orgMember.organization_id }; + console.log(`allCourses`, allCourses); + + return { allCourses }; } diff --git a/src/components/Navigation/index.svelte b/src/components/Navigation/index.svelte index 3748f9f4..e4193e2b 100644 --- a/src/components/Navigation/index.svelte +++ b/src/components/Navigation/index.svelte @@ -28,7 +28,7 @@ {#if $user.isLoggedIn} -
  • +
  • -
  • +
  • -
  • +