import Cookies from "js-cookie";

const TokenKey = "Token";
export const auth = {
  getToken: () => Cookies.get(TokenKey),
  setToken: (token: string) => Cookies.set(TokenKey, token),
  removeToken: () => Cookies.remove(TokenKey)
};

export const login = {
  get: () => {
    const x = Cookies.get("Login") || "/user";
    login.remove();
    return x;
  },
  set: (value: string) => Cookies.set("Login", value),
  remove: () => Cookies.remove("Login")
};

const languageKey = "language";
export const getLanguage = () => Cookies.get(languageKey);
export const setLanguage = (language: string) =>
  Cookies.set(languageKey, language);
