Browse Source

Add token service

pull/341/head
Hironsan 5 years ago
parent
commit
e16d635d02
1 changed files with 30 additions and 0 deletions
  1. 30
      frontend/services/token.service.js

30
frontend/services/token.service.js

@ -0,0 +1,30 @@
const TOKEN_KEY = 'access_token'
const REFRESH_TOKEN_KEY = 'refresh_token'
class 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 default new TokenService()
Loading…
Cancel
Save