import Cookies from 'js-cookie';

export const TOKEN_KEY = 'X-Token';
export const PERMISSION_KEY = 'Permission';

export const setToken = (token: string) => {
  Cookies.set(TOKEN_KEY, token);
};

export const getToken = () => {
  return Cookies.get(TOKEN_KEY);
};

export const removeToken = () => {
  Cookies.remove(TOKEN_KEY);
};

export const setPermission = (permission: number[]) => {
  Cookies.set(PERMISSION_KEY, permission.join(','));
};

export const getPermission = () => {
  return Cookies.get(PERMISSION_KEY);
};

export const removePermission = () => {
  Cookies.remove(PERMISSION_KEY);
};
