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
|
|
@ -6,6 +6,7 @@ import { getAPIUrl } from '@services/config/config'
|
|||
import { unLinkResourcesToUserGroup } from '@services/usergroups/usergroups'
|
||||
import { swrFetcher } from '@services/utils/ts/requests'
|
||||
import { Globe, SquareUserRound, Users, UsersRound, X } from 'lucide-react'
|
||||
import { useLHSession } from '@components/Contexts/LHSessionContext'
|
||||
import React from 'react'
|
||||
import toast from 'react-hot-toast'
|
||||
import useSWR, { mutate } from 'swr'
|
||||
|
|
@ -17,13 +18,15 @@ type EditCourseAccessProps = {
|
|||
|
||||
function EditCourseAccess(props: EditCourseAccessProps) {
|
||||
const [error, setError] = React.useState('')
|
||||
const session = useLHSession() as any;
|
||||
const access_token = session?.data?.tokens?.access_token;
|
||||
|
||||
const course = useCourse() as any
|
||||
const dispatchCourse = useCourseDispatch() as any
|
||||
const courseStructure = course.courseStructure
|
||||
const { data: usergroups } = useSWR(
|
||||
courseStructure ? `${getAPIUrl()}usergroups/resource/${courseStructure.course_uuid}` : null,
|
||||
swrFetcher
|
||||
(url) => swrFetcher(url, access_token)
|
||||
)
|
||||
const [isPublic, setIsPublic] = React.useState(courseStructure.public)
|
||||
|
||||
|
|
@ -109,7 +112,7 @@ function EditCourseAccess(props: EditCourseAccessProps) {
|
|||
status="info"
|
||||
></ConfirmationModal>
|
||||
</div>
|
||||
{!isPublic ? ( <UserGroupsSection usergroups={usergroups} />) : null}
|
||||
{!isPublic ? (<UserGroupsSection usergroups={usergroups} />) : null}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue