import axios from 'axios'

export function handleLogin(userId) {
  localStorage.setItem("user", userId)
}

export async function handleLogout() {
  alert("로그아웃되었습니다.")
  localStorage.removeItem("user")
  await axios.get('/api/auth/logout') 
  window.location.href='/'
}

export function isAuthenticated() {
  const userId = localStorage.getItem('loginStatus')
  if (userId) {
      return userId
  }else{
      return false
  }
}
