Auth.js 659 Bytes
Newer Older
1
import axios from 'axios';
2
3
4
5
6
7
8
9
10
11
12
13
import { callUserInfo, checkCookies } from './CheckDB';

export function haveLogined() {
    callUserInfo().then((res) => {
        if (res && checkCookies()) {
            return true
        }
        else {
            console.log('object')
            console.log(res)
        }
    })
14
15
}

16
17
18
export function isOauth(value) {
    const TFoauth = value
    return TFoauth;
19
20
21
}

export function isLogined() {
22
23
    const whetherlogin = localStorage.getItem('login')
    if (whetherlogin === 'false') {
24
25
        return false
    }
26
    else {
27
28
29
        return true
    }
}
Spark's avatar
Spark committed
30

31
32
33
export function logout() {
    localStorage.setItem('login', false)
}