import cookie from 'js-cookie';

const TOKEN = 'gastro-token';
const USER = 'gastro-user';
const REF_TOKEN = 'gastro-refresh';

export const getToken = () => {
  return cookie.get(TOKEN);
};

export const getMe = () => {
  return cookie.get(USER);
};

export const removeToken = () => {
  cookie.remove(TOKEN);
};

export const removeUser = () => {
  cookie.remove(USER);
};

export const setToken = (value: string) => {
  cookie.set(TOKEN, value);
};

export const setUser = (value: string) => {
  cookie.set(USER, value);
};

export const setRefToken = (value: string) => {
  cookie.set(REF_TOKEN, value);
};

export const removeRefToken = () => {
  cookie.remove(REF_TOKEN);
};

export const getRefToken = () => {
  return cookie.get(REF_TOKEN);
};
