mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
fix: session auth issues
This commit is contained in:
parent
1708b36818
commit
08cc97f557
70 changed files with 607 additions and 427 deletions
|
|
@ -4,6 +4,7 @@ import { getAPIUrl, getUriWithOrg } from '@services/config/config'
|
|||
import { removeCourse } from '@services/courses/activity'
|
||||
import { getCourseThumbnailMediaDirectory } from '@services/media/media'
|
||||
import { revalidateTags } from '@services/utils/ts/requests'
|
||||
import { useLHSession } from '@components/Contexts/LHSessionContext'
|
||||
import Link from 'next/link'
|
||||
import { useRouter } from 'next/navigation'
|
||||
import { useEffect } from 'react'
|
||||
|
|
@ -17,6 +18,8 @@ interface TrailCourseElementProps {
|
|||
|
||||
function TrailCourseElement(props: TrailCourseElementProps) {
|
||||
const org = useOrg() as any
|
||||
const session = useLHSession() as any;
|
||||
const access_token = session?.data?.tokens?.access_token;
|
||||
const courseid = props.course.course_uuid.replace('course_', '')
|
||||
const course = props.course
|
||||
const router = useRouter()
|
||||
|
|
@ -29,7 +32,7 @@ function TrailCourseElement(props: TrailCourseElementProps) {
|
|||
|
||||
async function quitCourse(course_uuid: string) {
|
||||
// Close activity
|
||||
let activity = await removeCourse(course_uuid, props.orgslug)
|
||||
let activity = await removeCourse(course_uuid, props.orgslug,access_token)
|
||||
// Mutate course
|
||||
await revalidateTags(['courses'], props.orgslug)
|
||||
router.refresh()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue