Skip to content

Commit

Permalink
Extract named logout function
Browse files Browse the repository at this point in the history
  • Loading branch information
emlun committed Dec 3, 2024
1 parent 3f66769 commit e122daf
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/context/SessionContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,18 @@ export const SessionContextProvider = ({ children }) => {
const api = useApi(isOnline);
const keystore = useLocalStorageKeystore();

const logout = async () => {
// Clear URL parameters
sessionStorage.setItem('freshLogin', 'true');
api.clearSession();
await keystore.close();
};

const value: SessionContextValue = {
api,
isLoggedIn: api.isLoggedIn() && keystore.isOpen(),
keystore,
logout: async () => {

// Clear URL parameters
sessionStorage.setItem('freshLogin', 'true');
api.clearSession();
await keystore.close();

},
logout,
};

return (
Expand Down

0 comments on commit e122daf

Please sign in to comment.