export function setCookie(name: string, value: string) {
  document.cookie = `${name}=${value};path=/`;
}

export function getCookie(name: string) {
  let cookieArray = document.cookie.split(";");
  for (let i = 0; i < cookieArray.length; i++) {
    let cookieData = cookieArray[i].split("=");
    if (cookieData[0].trim() === name) {
      if (cookieData[1]) {
        return cookieData[1];
      }
    }
  }

  return "";
}

export function deleteCookie(name: string) {
  document.cookie = `${name} = ;path=/`;
}
