auth.js 448 Bytes
Newer Older
Kim, Chaerin's avatar
merge19    
Kim, Chaerin committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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
  }
}