generated from nimblehq/git-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#36] axios interceptors for appending token or for obtaining refresh
- Loading branch information
1 parent
71150ac
commit 90c772d
Showing
7 changed files
with
81 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
export const PASSWORD_MIN_LENGTH = 5; | ||
|
||
export const LOGIN_URL = '/login'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,11 @@ | ||
type UserToken = | ||
| { | ||
access_token: string; | ||
refresh_token: string; | ||
} | ||
| '{}'; | ||
|
||
export const getToken = (): UserToken => { | ||
export const getToken = () => { | ||
return JSON.parse(localStorage.getItem('UserToken') || '{}'); | ||
}; | ||
|
||
export const setToken = (token: UserToken) => { | ||
export const setToken = (token: { access_token: string; refresh_token: string }) => { | ||
localStorage.setItem('UserToken', JSON.stringify(token)); | ||
}; | ||
|
||
export const clearToken = () => { | ||
localStorage.removeItem('UserToken'); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters