/*
    Storage本地储存
*/
export default {
  set(type, key, value) {
    if (type == 1) {
      sessionStorage.setItem(key, JSON.stringify(value));
    } else {
      localStorage.setItem(key, JSON.stringify(value));
    }
  },
  get(type, key) {
    if (type == 1) {
      return JSON.parse(sessionStorage.getItem(key));
    } else {
      return JSON.parse(localStorage.getItem(key));
    }
  },
  remove(type, key) {
    if (type == 1) {
      sessionStorage.removeItem(key);
    } else {
      localStorage.removeItem(key);
    }
  },
  clear(type) {
    if (type == 1) {
      sessionStorage.clear();
    } else {
      localStorage.clear();
    }
  },
};
