const TOKEN_KEY = "pap-cytx-token";
const USER_INFO_KEY = "pap-cytx-user-info";

export function setToken(token) {
  uni.setStorageSync(TOKEN_KEY, token);
}

export function getToken() {
  return uni.getStorageSync(TOKEN_KEY) || "";
}

export function clearToken() {
  uni.removeStorageSync(TOKEN_KEY);
}

export function setUserInfo(userInfo) {
  uni.setStorageSync(USER_INFO_KEY, userInfo);
}

export function getUserInfo() {
  return uni.getStorageSync(USER_INFO_KEY) || null;
}

export function clearUserInfo() {
  uni.removeStorageSync(USER_INFO_KEY);
}

export function clearAll() {
  clearToken();
  clearUserInfo();
}
