auth.ts 542 Bytes
const isLogin = () => {
  return !!localStorage.getItem('access_token');
};

const getToken = () => {
  return localStorage.getItem('access_token') || localStorage.getItem('refresh_token');
};

const setToken = (accessToken: string, refreshToken: string) => {
  localStorage.setItem('access_token', accessToken);
  localStorage.setItem('refresh_token', refreshToken);
};

const clearToken = () => {
  localStorage.removeItem('access_token');
  localStorage.removeItem('refresh_token');
};

export { isLogin, getToken, setToken, clearToken };