feat: add loading indicator and improve loading screens

This commit is contained in:
swve 2024-06-13 23:00:33 +01:00
parent 866111aa4c
commit 29219391ea
5 changed files with 32 additions and 5 deletions

View file

@ -4,6 +4,7 @@ import { swrFetcher } from '@services/utils/ts/requests'
import React, { createContext, useContext, useEffect, useReducer } from 'react'
import useSWR from 'swr'
import { useLHSession } from '@components/Contexts/LHSessionContext'
import PageLoading from '@components/Objects/Loaders/PageLoading'
export const CourseContext = createContext(null)
export const CourseDispatchContext = createContext(null)
@ -33,7 +34,7 @@ export function CourseProvider({ children, courseuuid }: any) {
}, [courseStructureData]);
if (error) return <div>Failed to load course structure</div>;
if (!courseStructureData) return <div>Loading...</div>;
if (!courseStructureData) return <PageLoading/>;
return (
<CourseContext.Provider value={state}>