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

@ -15,6 +15,7 @@ import {
import { Hexagon } from 'lucide-react'
import Modal from '@components/StyledElements/Modal/Modal'
import NewChapterModal from '@components/Objects/Modals/Chapters/NewChapter'
import { useLHSession } from '@components/Contexts/LHSessionContext'
type EditCourseStructureProps = {
orgslug: string
@ -38,6 +39,8 @@ export type OrderPayload =
const EditCourseStructure = (props: EditCourseStructureProps) => {
const router = useRouter()
const session = useLHSession() as any;
const access_token = session?.data?.tokens?.access_token;
// Check window availability
const [winReady, setwinReady] = useState(false)
@ -57,7 +60,7 @@ const EditCourseStructure = (props: EditCourseStructureProps) => {
// Submit new chapter
const submitChapter = async (chapter: any) => {
await createChapter(chapter)
await createChapter(chapter,access_token)
mutate(`${getAPIUrl()}courses/${course.courseStructure.course_uuid}/meta`)
await revalidateTags(['courses'], props.orgslug)
router.refresh()