Skip to content
This repository has been archived by the owner on May 24, 2022. It is now read-only.

Commit

Permalink
Clear tokens from localstorage
Browse files Browse the repository at this point in the history
  • Loading branch information
stijndcl committed Apr 28, 2022
1 parent 57d684d commit c2c226b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions frontend/src/contexts/auth-context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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);
}

0 comments on commit c2c226b

Please sign in to comment.