Auth.js 967 Bytes
Newer Older
1
import axios from 'axios';
2
import Swal from 'sweetalert2';
3

4
5
6
export function isOauth(value) {
    const TFoauth = value
    return TFoauth;
7
8
9
}

export function isLogined() {
10
11
    const whetherlogin = localStorage.getItem('login')
    if (whetherlogin === 'false') {
12
13
        return false
    }
14
    else {
15
16
17
        return true
    }
}
Spark's avatar
Spark committed
18

19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
export async function localLogout() {
    await axios.get('/api/logout')
        .then(function () {
            localStorage.clear();
            Swal.fire({
                title: '로그아웃 성공!',
                text: '🙏 안녕히 가세요 🙏',
                icon: 'warning',
                customClass: 'swal-wide',
                confirmButtonText: '확인',
            }).then((res) => {
                if (res.isConfirmed) {
                    window.location.replace('/')
                }
                else {
                    window.location.replace('/')
                }
            })
        })
}