Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed unused authcontext methods #2196

Merged
merged 1 commit into from
Nov 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 1 addition & 10 deletions src/components/AuthenticationContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
*/

import { createContext, ReactNode, useEffect, useState, useCallback } from "react";
import { createContext, ReactNode, useEffect, useState } from "react";
import { gql } from "@apollo/client";
import config from "../config";
import { GQLMyNdlaDataQuery, GQLMyNdlaPersonalDataFragmentFragment } from "../graphqlTypes";
Expand All @@ -20,17 +20,13 @@ export type MyNDLAUserType = GQLMyNdlaPersonalDataFragmentFragment & {
interface AuthContextType {
authenticated: boolean;
authContextLoaded: boolean;
login: () => void;
logout: () => void;
user: MyNDLAUserType | undefined;
examLock: boolean;
}

export const AuthContext = createContext<AuthContextType>({
authenticated: false,
authContextLoaded: false,
login: () => {},
logout: () => {},
user: undefined,
examLock: false,
});
Expand Down Expand Up @@ -114,16 +110,11 @@ const AuthenticationContext = ({ children }: Props) => {
}
}, [myNdlaData]);

const login = useCallback(() => setAuthenticated(true), []);
const logout = useCallback(() => setAuthenticated(false), []);

return (
<AuthContext.Provider
value={{
authenticated,
authContextLoaded,
login,
logout,
user,
examLock,
}}
Expand Down
Loading