import axios from "axios" //자동으로 localstorage에 login이 생성됨 export function handleLogin(data) { localStorage.setItem('userId', data.user._id) localStorage.setItem('name', data.user.username) } export async function handleLogout() { localStorage.clear(); await axios.get('/auth/logout') } export function isAuthenticated() { const userId = localStorage.getItem('userId') if (userId) { return userId } else { return false } }