import Cookies from 'js-cookie'

const CsrfToken = 'csrftoken'
const SessionId = 'sessionid'

export function getToken() {
  return Cookies.get(CsrfToken)
}

export function setToken(token) {
  return Cookies.set(CsrfToken, token)
}

export function removeToken() {
  localStorage.removeItem('menuset')
  return Cookies.remove(CsrfToken)
}

export function clearAuth() {
  Cookies.remove(CsrfToken)
  Cookies.remove(SessionId)
}

export function isAuth() {
  return Cookies.get(SessionId) && Cookies.get(CsrfToken)
}
