import Cookies from 'js-cookie';
import DateUtil from './DateUtil';

const inOneHours = new Date(DateUtil.getConvertKST(new Date(new Date().getTime() + 60 * 60 * 1000)));

const setCookie = (key: string, value: string, expires?: number | Date | undefined) => {
  Cookies.set(key, value, { expires });
};

const getCookie = (key: string) => {
  return Cookies.get(key) || '';
};

const deleteCookie = (key: string) => {
  Cookies.set(key, '', { expires: 0 });
};

export default {
  inOneHours,
  setCookie,
  getCookie,
  deleteCookie,
};
