From c2c226ba93a892e5742cf24e3ee1b3aa7e8a26e1 Mon Sep 17 00:00:00 2001 From: stijndcl Date: Thu, 28 Apr 2022 21:28:26 +0200 Subject: [PATCH] Clear tokens from localstorage --- frontend/src/contexts/auth-context.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/frontend/src/contexts/auth-context.tsx b/frontend/src/contexts/auth-context.tsx index f31fc6ff2..bfd2a818d 100644 --- a/frontend/src/contexts/auth-context.tsx +++ b/frontend/src/contexts/auth-context.tsx @@ -3,6 +3,7 @@ import { Role } from "../data/enums"; import React, { useContext, ReactNode, useState } from "react"; import { User } from "../data/interfaces"; import { setCurrentEdition } from "../utils/session-storage"; +import { setAccessToken, setRefreshToken } from "../utils/local-storage"; /** * Interface that holds the data stored in the AuthContext. @@ -92,6 +93,10 @@ export function logOut(authContext: AuthContextState) { authContext.setRole(null); authContext.setEditions([]); + // Remove tokens from LocalStorage + setAccessToken(null); + setRefreshToken(null); + // Remove current edition from SessionStorage setCurrentEdition(null); }