mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
feat: use session access_tokens
This commit is contained in:
parent
08cc97f557
commit
52f2235942
74 changed files with 413 additions and 440 deletions
|
|
@ -5,7 +5,7 @@ import Modal from '@components/StyledElements/Modal/Modal'
|
|||
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 { Globe, SquareUserRound, Users, X } from 'lucide-react'
|
||||
import { useLHSession } from '@components/Contexts/LHSessionContext'
|
||||
import React from 'react'
|
||||
import toast from 'react-hot-toast'
|
||||
|
|
@ -122,9 +122,11 @@ function EditCourseAccess(props: EditCourseAccessProps) {
|
|||
function UserGroupsSection({ usergroups }: { usergroups: any[] }) {
|
||||
const course = useCourse() as any
|
||||
const [userGroupModal, setUserGroupModal] = React.useState(false)
|
||||
const session = useLHSession() as any;
|
||||
const access_token = session?.data?.tokens?.access_token;
|
||||
|
||||
const removeUserGroupLink = async (usergroup_id: number) => {
|
||||
const res = await unLinkResourcesToUserGroup(usergroup_id, course.courseStructure.course_uuid)
|
||||
const res = await unLinkResourcesToUserGroup(usergroup_id, course.courseStructure.course_uuid,access_token)
|
||||
if (res.status === 200) {
|
||||
toast.success('Successfully unliked from usergroup')
|
||||
mutate(`${getAPIUrl()}usergroups/resource/${course.courseStructure.course_uuid}`)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue