// 访问 token 缓存的 key
const ACCESS_TOKEN_KEY = "access_token";
// 访问 抖音token 缓存的 key
const DOUYIN_ACCESS_TOKEN_KEY = "douyin_access_token";
// 刷新 token 缓存的 key
const REFRESH_TOKEN_KEY = "refresh_token";

//抖音 token
function getDouyinToken() {
  return localStorage.getItem(DOUYIN_ACCESS_TOKEN_KEY) || "";
}
function setDouyinToken(token: string) {
  return localStorage.setItem(DOUYIN_ACCESS_TOKEN_KEY, token);
}
function getToken(): string {
  return localStorage.getItem(ACCESS_TOKEN_KEY) || "";
}


function setToken(token: string) {
  localStorage.setItem(ACCESS_TOKEN_KEY, token);
}

function getRefreshToken(): string {
  return localStorage.getItem(REFRESH_TOKEN_KEY) || "";
}

function setRefreshToken(token: string) {
  localStorage.setItem(REFRESH_TOKEN_KEY, token);
}

function clearToken() {
  localStorage.removeItem(ACCESS_TOKEN_KEY);
  localStorage.removeItem(REFRESH_TOKEN_KEY);
}

export { getToken, setToken, clearToken, getRefreshToken, setRefreshToken, getDouyinToken, setDouyinToken };
