export default {
  get(key) {
    return localStorage.getItem(key);
  },
  set(key, value) {
    localStorage.setItem(key, value);
  },
  remove(key) {
    localStorage.removeItem(key);
  },
  // 保存token到本地缓存
  setToken(token) {
    this.set("token", token);
  },
  // 保存用户信息到本地缓存
  setAuth(auth) {
    this.set("auth", JSON.stringify(auth));
  },
  // 读取token
  getToken() {
    return this.get("token");
  },
  // 读取用户信息
  getAuth() {
    return this.get("auth") ? JSON.parse(this.get("auth")) : {};
  },
};
