Delete a course functionality
This commit is contained in:
@@ -47,7 +47,7 @@
|
||||
let openPopover = false;
|
||||
let player = null;
|
||||
let aiButtonClass =
|
||||
'flex items-center px-5 py-2 border border-gray-300 hover:bg-gray-200 rounded-md w-full mb-2';
|
||||
'flex items-center px-5 py-2 border border-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 rounded-md w-full mb-2';
|
||||
|
||||
const onChange =
|
||||
(tab = 0) =>
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
import { settingsDialog } from './store';
|
||||
import { course } from '$lib/components/Course/store';
|
||||
import { updateCourse, deleteCourse } from '$lib/utils/services/courses';
|
||||
import { currentOrgPath } from '$lib/utils/store/org';
|
||||
|
||||
let shouldDelete = false;
|
||||
let avatar;
|
||||
@@ -41,7 +42,7 @@
|
||||
async function handleDelete() {
|
||||
$settingsDialog.open = false;
|
||||
await deleteCourse($course.id);
|
||||
goto('/courses');
|
||||
goto($currentOrgPath + '/courses');
|
||||
}
|
||||
|
||||
// function setAvatar(logo) {
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
import getCurrencyFormatter from '$lib/utils/functions/getCurrencyFormatter';
|
||||
import OverflowMenuHorizontalIcon from 'carbon-icons-svelte/lib/OverflowMenuHorizontal.svelte';
|
||||
import ArrowRight from 'carbon-icons-svelte/lib/ArrowRight.svelte';
|
||||
// import { deleteCourse } from '$lib/utils/services/courses';
|
||||
|
||||
export let bannerImage: string | undefined;
|
||||
export let id = '';
|
||||
@@ -17,6 +18,7 @@
|
||||
export let totalLessons = 0;
|
||||
export let currency = 'NGN';
|
||||
export let isOnLandingPage = false;
|
||||
// export let onDelete = (id: string) => {};
|
||||
|
||||
let formatter = getCurrencyFormatter(currency);
|
||||
|
||||
@@ -37,10 +39,15 @@
|
||||
}
|
||||
// {
|
||||
// label: 'Delete',
|
||||
// show: () => role_id === ROLE.TUTOR,
|
||||
// onClick() {
|
||||
// console.log('Deleting');
|
||||
// },
|
||||
// },
|
||||
// (async () => {
|
||||
// await deleteCourse(id);
|
||||
// onDelete(id);
|
||||
// console.log('Deleting');
|
||||
// })();
|
||||
// }
|
||||
// }
|
||||
].filter((option) => option.show());
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
<script>
|
||||
<script lang="ts">
|
||||
import Box from '../Box/index.svelte';
|
||||
import Card from './components/Card/index.svelte';
|
||||
import CardLoader from './components/Card/Loader.svelte';
|
||||
import CoursesEmptyIcon from '../Icons/CoursesEmptyIcon.svelte';
|
||||
import CopyCourseModal from './components/CopyCourseModal/index.svelte';
|
||||
import { courses, courseMetaDeta } from './store';
|
||||
import { isMobile } from '$lib/utils/store/useMobile';
|
||||
</script>
|
||||
|
||||
<CopyCourseModal />
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { writable } from 'svelte/store';
|
||||
import type { Course } from '$lib/utils/types';
|
||||
|
||||
export const courses = writable([]);
|
||||
export const courses = writable<Course[]>([]);
|
||||
export const courseMetaDeta = writable({
|
||||
isLoading: true
|
||||
});
|
||||
Reference in New Issue
Block a user