mirror of
https://git.meshkee.com/cssd/cssd-back.git
synced 2026-10-13 17:01:07 +03:30
init project
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
const TOKEN_KEY = 'access_token'
|
||||
const REFRESH_TOKEN_KEY = 'refresh_token'
|
||||
|
||||
/**
|
||||
* Manage the how Access Tokens are being stored and retreived from storage.
|
||||
*
|
||||
* Current implementation stores to localStorage. Local Storage should always be
|
||||
* accessed through this instace.
|
||||
**/
|
||||
const TokenService = {
|
||||
getToken() {
|
||||
return localStorage.getItem(TOKEN_KEY)
|
||||
},
|
||||
|
||||
saveToken(accessToken) {
|
||||
localStorage.setItem(TOKEN_KEY, accessToken)
|
||||
},
|
||||
|
||||
removeToken() {
|
||||
localStorage.removeItem(TOKEN_KEY)
|
||||
},
|
||||
|
||||
getRefreshToken() {
|
||||
return localStorage.getItem(REFRESH_TOKEN_KEY)
|
||||
},
|
||||
|
||||
saveRefreshToken(refreshToken) {
|
||||
localStorage.setItem(REFRESH_TOKEN_KEY, refreshToken)
|
||||
},
|
||||
|
||||
removeRefreshToken() {
|
||||
localStorage.removeItem(REFRESH_TOKEN_KEY)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export { TokenService }
|
||||
Reference in New Issue
Block a user