const AccessTokenKey = 'ACCESS_TOKEN';
const RefreshTokenKey = 'REFRESH_TOKEN';

// ========== Token 相关 ==========

export function getAccessToken() {
  return localStorage.getItem(AccessTokenKey);
}

export function getRefreshToken() {
  return localStorage.getItem(RefreshTokenKey);
}

export function setToken(token) {
  localStorage.setItem(AccessTokenKey, token.accessToken);
  localStorage.setItem(RefreshTokenKey, token.refreshToken);
}

export function removeToken() {
  localStorage.removeItem(AccessTokenKey);
  localStorage.removeItem(RefreshTokenKey);
}
// ========== 账号相关 ==========

const UsernameKey = 'USERNAME';
const PasswordKey = 'PASSWORD';
const RememberMeKey = 'REMEMBER_ME';
export function removeUsername() {
  localStorage.removeItem(UsernameKey);
}

export function removePassword() {
  localStorage.removeItem(PasswordKey);
}

export function removeRememberMe() {
  localStorage.removeItem(RememberMeKey);
}
