Skip to content

Commit

Permalink
[#21] Add UserToken helper module abstraction that uses LocalStorage …
Browse files Browse the repository at this point in the history
…for tokens
  • Loading branch information
liamstevens111 committed Feb 21, 2023
1 parent 770c7a2 commit 5858179
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/helpers/localStorage.ts

This file was deleted.

12 changes: 12 additions & 0 deletions src/helpers/userToken.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
type UserToken = {
accessToken: string;
refreshToken: string;
};

export const getToken = (): UserToken | string => {
return JSON.parse(localStorage.getItem('UserToken') || '');
};

export const setToken = (token: UserToken) => {
localStorage.setItem('UserToken', JSON.stringify(token));
};

0 comments on commit 5858179

Please sign in to comment.