export const getLsItem = (keyName) => {
  return window.localStorage.getItem(keyName);
};

export const setLsItem = (keyName, data) => {
  localStorage.setItem(keyName, data);
};

export const removeLsItem = (keyName) => {
  localStorage.removeItem(keyName);
};

export const clearStorage = () => {
  localStorage.clear();
};

// jwt.service
const ID_TOKEN_KEY = "id_token";
const ID_USERSTT_KEY = "user_stt";

export const getToken = () => {
  let token = localStorage.getItem(ID_TOKEN_KEY);

  if (token == null || token == "" || token == undefined) return "GuestAccess";
  return token;
};

export const saveToken = (token) => {
  localStorage.setItem(ID_TOKEN_KEY, token);
};

export const destroyToken = () => {
  localStorage.removeItem(ID_TOKEN_KEY);
};
export const getUserStt = () => {
  return localStorage.getItem(ID_USERSTT_KEY);
};

export const saveUserStt = (stt) => {
  localStorage.setItem(ID_USERSTT_KEY, stt);
};

export const destroyUserStt = () => {
  localStorage.removeItem(ID_USERSTT_KEY);
};

// export default {
//   getToken,
//   saveToken,
//   destroyToken,
//   saveUserStt,
//   getUserStt,
//   destroyUserStt,
//   clearStorage
// };
