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

@ -1,6 +1,6 @@
import React, { useEffect, useState } from 'react'
import UserAvatar from '../UserAvatar'
import { useSession } from 'next-auth/react'
import { useLHSession } from '@components/Contexts/LHSessionContext'
import { getUserAvatarMediaDirectory } from '@services/media/media';
import { getCollaborationServerUrl } from '@services/config/config';
import { useOrg } from '@components/Contexts/OrgContext';
@ -11,7 +11,7 @@ type ActiveAvatarsProps = {
}
function ActiveAvatars(props: ActiveAvatarsProps) {
const session = useSession() as any;
const session = useLHSession() as any;
const org = useOrg() as any;
const [activeUsers, setActiveUsers] = useState({} as any);

View file

@ -41,7 +41,7 @@ import html from 'highlight.js/lib/languages/xml'
import python from 'highlight.js/lib/languages/python'
import java from 'highlight.js/lib/languages/java'
import { CourseProvider } from '@components/Contexts/CourseContext'
import { useSession } from 'next-auth/react'
import { useLHSession } from '@components/Contexts/LHSessionContext'
import AIEditorToolkit from './AI/AIEditorToolkit'
import useGetAIFeatures from '@components/AI/Hooks/useGetAIFeatures'
import UserAvatar from '../UserAvatar'
@ -65,7 +65,7 @@ interface Editor {
}
function Editor(props: Editor) {
const session = useSession() as any
const session = useLHSession() as any
const dispatchAIEditor = useAIEditorDispatch() as any
const aiEditorState = useAIEditor() as AIEditorStateTypes
const is_ai_feature_enabled = useGetAIFeatures({ feature: 'editor' })

View file

@ -5,7 +5,7 @@ import { updateActivity } from '@services/courses/activities'
import { toast } from 'react-hot-toast'
import Toast from '@components/StyledElements/Toast/Toast'
import { OrgProvider } from '@components/Contexts/OrgContext'
import { useSession } from 'next-auth/react'
import { useLHSession } from '@components/Contexts/LHSessionContext'
// Collaboration
import { HocuspocusProvider } from '@hocuspocus/provider'
@ -24,7 +24,7 @@ interface EditorWrapperProps {
}
function EditorWrapper(props: EditorWrapperProps): JSX.Element {
const session = useSession() as any
const session = useLHSession() as any
// Define provider in the state
const [provider, setProvider] = React.useState<HocuspocusProvider | null>(null);
const [thisPageColor, setThisPageColor] = useState(randomColor({ luminosity: 'light' }) as string)