Skip to content
Snippets Groups Projects
Commit 571042f5 authored by Jacopo Gasparetto's avatar Jacopo Gasparetto
Browse files

Add OAuth2 logout function

parent d7c2d65f
No related branches found
No related tags found
No related merge requests found
......@@ -3,6 +3,7 @@ import { createContext } from "react";
export interface OAuthContextProps extends IOAuthState {
signinPopup(): void;
logout(): void;
}
export const OAuthContext = createContext<OAuthContextProps | undefined>(undefined);
......@@ -168,10 +168,15 @@ export const OAuthProvider = (props: OAuthProviderProps): JSX.Element => {
}, [props]);
const logout = useCallback(() => {
setOAuthState(initialOAuthState);
}, []);
return (
<OAuthContext.Provider
value={{
signinPopup: signinPopup,
logout: logout,
isAuthenticated: oAuthState.isAuthenticated,
isLoading: oAuthState.isLoading,
error: oAuthState.error,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment