feat: Add loading toasts

This commit is contained in:
swve 2024-08-13 18:13:58 +02:00
parent 0f2b8689c4
commit c68fa66ff8
7 changed files with 34 additions and 4 deletions

View file

@ -11,6 +11,7 @@ import { useLHSession } from '@components/Contexts/LHSessionContext'
import Link from 'next/link'
import { useRouter } from 'next/navigation'
import React, { useEffect } from 'react'
import toast from 'react-hot-toast'
type PropsType = {
course: any
@ -28,7 +29,10 @@ function CourseThumbnail(props: PropsType) {
const session = useLHSession() as any;
async function deleteCourses(course_uuid: any) {
const toast_loading = toast.loading('Deleting course...')
await deleteCourseFromBackend(course_uuid, session.data?.tokens?.access_token)
toast.dismiss(toast_loading)
toast.success('Course deleted successfully')
await revalidateTags(['courses'], props.orgslug)
router.refresh()