fix: session auth issues

This commit is contained in:
swve 2024-05-27 20:58:32 +02:00
parent 1708b36818
commit 08cc97f557
70 changed files with 607 additions and 427 deletions

View file

@ -7,6 +7,7 @@ import { deleteCollection } from '@services/courses/collections'
import { getCourseThumbnailMediaDirectory } from '@services/media/media'
import { revalidateTags } from '@services/utils/ts/requests'
import { X } from 'lucide-react'
import { useLHSession } from '@components/Contexts/LHSessionContext'
import Link from 'next/link'
import { useRouter } from 'next/navigation'
import React from 'react'
@ -74,9 +75,10 @@ function CollectionThumbnail(props: PropsType) {
const CollectionAdminEditsArea = (props: any) => {
const router = useRouter()
const session = useLHSession() ;
const deleteCollectionUI = async (collectionId: number) => {
await deleteCollection(collectionId)
await deleteCollection(collectionId, session.data?.tokens?.access_token)
await revalidateTags(['collections'], props.orgslug)
// reload the page
router.refresh()