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,9 +15,11 @@ import React, { useState } from 'react'
import { BarLoader } from 'react-spinners'
import { revalidateTags } from '@services/utils/ts/requests'
import { useRouter } from 'next/navigation'
import { useLHSession } from '@components/Contexts/LHSessionContext'
function CreateCourseModal({ closeModal, orgslug }: any) {
const [isSubmitting, setIsSubmitting] = useState(false)
const session = useLHSession()
const [name, setName] = React.useState('')
const [description, setDescription] = React.useState('')
const [learnings, setLearnings] = React.useState('')
@ -71,7 +73,8 @@ function CreateCourseModal({ closeModal, orgslug }: any) {
let status = await createNewCourse(
orgId,
{ name, description, tags, visibility },
thumbnail
thumbnail,
session.data?.tokens?.access_token
)
await revalidateTags(['courses'], orgslug)
setIsSubmitting(false)
@ -80,9 +83,6 @@ function CreateCourseModal({ closeModal, orgslug }: any) {
closeModal()
router.refresh()
await revalidateTags(['courses'], orgslug)
// refresh page (FIX for Next.js BUG)
// window.location.reload();
} else {
alert('Error creating course, please see console logs')
}