Skip to content

Commit

Permalink
Merge pull request #2196 from NDLANO/chore/remove-unused-authcontext-…
Browse files Browse the repository at this point in the history
…methods

Removed unused authcontext methods
  • Loading branch information
MaPoKen authored Nov 8, 2024
2 parents 936b7b5 + b4546fb commit 2900faa
Showing 1 changed file with 1 addition and 10 deletions.
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

0 comments on commit 2900faa

Please sign in to comment.