Newer
Older
urbanLifeline_YanAn / src / utils / auth.js
@zhangqy zhangqy on 3 Oct 547 bytes first commit
  1. import Cookies from 'js-cookie'
  2.  
  3. const TokenKey = 'Admin-Token'
  4.  
  5. const ExpiresInKey = 'Admin-Expires-In'
  6.  
  7. export function getToken() {
  8. return Cookies.get(TokenKey)
  9. }
  10.  
  11. export function setToken(token) {
  12. return Cookies.set(TokenKey, token)
  13. }
  14.  
  15. export function removeToken() {
  16. return Cookies.remove(TokenKey)
  17. }
  18.  
  19. export function getExpiresIn() {
  20. return Cookies.get(ExpiresInKey) || -1
  21. }
  22.  
  23. export function setExpiresIn(time) {
  24. return Cookies.set(ExpiresInKey, time)
  25. }
  26.  
  27. export function removeExpiresIn() {
  28. return Cookies.remove(ExpiresInKey)
  29. }