From fdab7c48507e0e1844927d6edb6b548556f36f32 Mon Sep 17 00:00:00 2001 From: emmanuel Date: Tue, 3 Oct 2023 12:29:06 +0000 Subject: [PATCH] CLASSROOMIO-T-187: Navigate to course on save Co-authored-by: Ifeanyi Nwosu Merge-request: CLASSROOMIO-MR-83 Merged-by: Best Admin --- .../components/NewCourseModal/index.svelte | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/lib/components/Courses/components/NewCourseModal/index.svelte b/src/lib/components/Courses/components/NewCourseModal/index.svelte index 19619155..1ecfa5b7 100644 --- a/src/lib/components/Courses/components/NewCourseModal/index.svelte +++ b/src/lib/components/Courses/components/NewCourseModal/index.svelte @@ -10,7 +10,9 @@ import { supabase } from '$lib/utils/functions/supabase'; import { profile } from '$lib/utils/store/user'; import { currentOrg } from '$lib/utils/store/org'; + import { goto } from '$app/navigation'; + let isLoading = false; let errors = { title: '', description: '' @@ -30,6 +32,7 @@ } async function createCourse(e) { + isLoading = true; const { hasError, fieldErrors } = validateForm($createCourseModal); errors = fieldErrors; @@ -70,8 +73,11 @@ group_id, role_id: ROLE.TUTOR }); - + if (newCourse[0] != null && newCourse[0].id) { + goto(`/courses/${newCourse[0]?.id}`); + } onClose(); + isLoading = false; } @@ -110,7 +116,13 @@ />
- +