auth.js 383 Bytes
Newer Older
Kim, Subin's avatar
Kim, Subin committed
1
import clientConfig from "./clientConfig";
한규민's avatar
push    
한규민 committed
2
3
4

export function handleLogin(user) {
    if (user) {
Kim, Subin's avatar
Kim, Subin committed
5
        localStorage.setItem(clientConfig.loginUser, JSON.stringify(user));
한규민's avatar
push    
한규민 committed
6
7
8
9
    }
}

export function getLocalUser() {
Kim, Subin's avatar
Kim, Subin committed
10
    const userData = localStorage.getItem(clientConfig.loginUser);
한규민's avatar
push    
한규민 committed
11
12
13
14
15
16
    let user = null;
    if (userData) {
        user = JSON.parse(userData);
    }
    return user;
}