export default () => {
  const clearLocalStorage = () => {
    localStorage.clear()
  }
  const clearCookies = () => {
    document.cookie.split(";").forEach((cookie) => {
      const eqPos = cookie.indexOf("=")
      const name = eqPos > -1 ? cookie.substring(0, eqPos) : cookie

      document.cookie = name + "=; max-age=- (any digit); path=/;"
    })
  }
  const clearCookiesAndLocalStorage = () => {
    clearCookies()
    clearLocalStorage()
  }

  return {
    clearCookies,
    clearCookiesAndLocalStorage,
    clearLocalStorage,
  }
}
