Auth.js 428 Bytes
Newer Older
이재연's avatar
이재연 committed
1
2
3
4
5
6
7
8
9
import axios from "axios"

export function handleLogin(){
    localStorage.setItem('loginStatus','true')
}

export async function handleLogout(){
    localStorage.removeItem('loginStatus')
    await axios.get('/api/auth/logout')
이재연's avatar
이재연 committed
10
11
12
13
14
15
16
17
18
19
    window.location.href='/'
}

export function isAuthenticated(){
    const userId= localStorage.getItem('loginStatus')
    if(userId){
        return userId
    } else{
        return false
    }
이재연's avatar
이재연 committed
20
}