Auth.js 434 Bytes
Newer Older
이재연's avatar
이재연 committed
1
2
3
4
5
6
7
8
9
const users=[
    { id:'wodus', password:'123'},
    {id:'kim', password:'456'},
]

export function signIn({id,password}){
    const user=users.find(user=>user.id===id && user.password===password);
    if (user===undefined) throw new Error();
    return user;
박상호's avatar
123    
박상호 committed
10
11
12
13
14
15
16
17
18
}

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