

const TOKEN_KEY = 'token';
const USER_INFO_KEY = 'user_info';
const PROJECT_INFO_KEY = 'project-info';

// 获取Token
export const getToken = () => {
  return uni.getStorageSync(TOKEN_KEY) || '';
};

// 存储Token
export const setToken = (token) => {
  uni.setStorageSync(TOKEN_KEY, token);
};

// 删除Token
export const removeToken = () => {
  uni.removeStorageSync(TOKEN_KEY);
};

// 存储用户信息
export const setUserInfo = (info) => {
  uni.setStorageSync(USER_INFO_KEY, info);
};

// 获取用户信息
export const getUserInfo = () => {
  return uni.getStorageSync(USER_INFO_KEY) || {};
};

// 删除用户信息
export const removeUserInfo = () => {
  uni.removeStorageSync(USER_INFO_KEY);
  uni.removeStorageSync(PROJECT_INFO_KEY);
};