CLASSROOMIO-T-187: Navigate to course on save
Co-authored-by: Ifeanyi Nwosu <[email protected]> Merge-request: CLASSROOMIO-MR-83 Merged-by: Best Admin <[email protected]>
This commit is contained in:
@@ -10,7 +10,9 @@
|
|||||||
import { supabase } from '$lib/utils/functions/supabase';
|
import { supabase } from '$lib/utils/functions/supabase';
|
||||||
import { profile } from '$lib/utils/store/user';
|
import { profile } from '$lib/utils/store/user';
|
||||||
import { currentOrg } from '$lib/utils/store/org';
|
import { currentOrg } from '$lib/utils/store/org';
|
||||||
|
import { goto } from '$app/navigation';
|
||||||
|
|
||||||
|
let isLoading = false;
|
||||||
let errors = {
|
let errors = {
|
||||||
title: '',
|
title: '',
|
||||||
description: ''
|
description: ''
|
||||||
@@ -30,6 +32,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function createCourse(e) {
|
async function createCourse(e) {
|
||||||
|
isLoading = true;
|
||||||
const { hasError, fieldErrors } = validateForm($createCourseModal);
|
const { hasError, fieldErrors } = validateForm($createCourseModal);
|
||||||
|
|
||||||
errors = fieldErrors;
|
errors = fieldErrors;
|
||||||
@@ -70,8 +73,11 @@
|
|||||||
group_id,
|
group_id,
|
||||||
role_id: ROLE.TUTOR
|
role_id: ROLE.TUTOR
|
||||||
});
|
});
|
||||||
|
if (newCourse[0] != null && newCourse[0].id) {
|
||||||
|
goto(`/courses/${newCourse[0]?.id}`);
|
||||||
|
}
|
||||||
onClose();
|
onClose();
|
||||||
|
isLoading = false;
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -110,7 +116,13 @@
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<div class="mt-5 flex items-center">
|
<div class="mt-5 flex items-center">
|
||||||
<PrimaryButton className="px-6 py-3" label="Finish" type="submit" />
|
<PrimaryButton
|
||||||
|
className="px-6 py-3"
|
||||||
|
label="Finish"
|
||||||
|
type="submit"
|
||||||
|
isDisabled={isLoading}
|
||||||
|
{isLoading}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|||||||
Reference in New Issue
Block a user