summaryrefslogtreecommitdiffstats
path: root/src/services/AuthService.js
blob: 2f580762fdfbd9d8cc071da5d6aec49f6c15fa41 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import axios from "axios";
import error_notify from './NotifyErrorService.js'

const url = 'http://localhost:8000/api/auth/'

export default {
    async login(data) {
        return await axios
        .post(url+'login/', data)
        .then(res => {
            return {
                data: res.data,
                status: res.status
            }
        })
        .catch(error => error_notify(error))
    },

    async register(data) { 
        return await axios
        .post(url+'register/', data)
        .then(res => {
            return {
                data: res.data,
                status: res.status
            }
        })
        .catch(error => error_notify(error))

    },

    async info(data) {
        return await axios
        .get(url+'info/?'+data)
        .then(res => {
            return {
                data: res.data,
                status: res.status
            }
        })
        .catch(error => error_notify(error))

    },

    async logout() {
        return await axios
        .post(url+'logout/')
        .then(res => {
            return {
                status: res.status
            }
        })
        .catch(error => error_notify(error))
    }
}