/*
 * @Author: wanglj
 * @Date: 2022-01-07 19:14:27
 * @LastEditors: wanglj
 * @LastEditTime: 2022-01-21 17:40:59
 * @Description: file content
 * @FilePath: \biobank_frontend02\src\utils\auth.js
 */
import Cookies from 'js-cookie'

const AppName = process.env.VUE_APP_TENANT + '-'
const TokenKey = AppName + 'Token'
const UuidKey = AppName + 'UUID'

export function getToken() {
  return sessionStorage.getItem(TokenKey)
}

export function setToken(token) {
  return sessionStorage.setItem(TokenKey, token)
}

export function removeToken() {
  return sessionStorage.removeItem(TokenKey)
}

export function getUUID() {
  return Cookies.get(UuidKey)
}

export function setUUID(uuid) {
  return Cookies.set(UuidKey, uuid)
}

export function removeUUID() {
  return Cookies.remove(UuidKey)
}

export function setProject(Project) {
  return Cookies.set('Project', Project)
}

export function getProject() {
  return Cookies.get('Project')
}

export function removeProject() {
  return Cookies.remove('Project')
}

export function authUser() {
  return JSON.stringify(Cookies.get('user'))
}
