blob: d03f2504d9c6dc8c02c1154dc1c42837091893c3 (
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
|
import axios from "axios";
import error_notify from './NotifyErrorService.js'
const url = 'http://localhost:8000/api/chat/'
export default {
async group_create(data) {
return await axios
.post(url+'groups/', data)
.then(res => {
return {
status: res.status
}
})
.catch(error => error_notify(error))
},
async get_all_user_groups() {
return await axios
.get(url+'groups/')
.then(res => {
return {
status: res.status,
data: res.data
}
})
.catch(error => error_notify(error))
},
async get_group_messages(group_pk) {
return await axios
.get(url+`groups/detail/${group_pk}/messages/`)
.then(res => {
return {
status: res.status,
data: res.data
}
})
.catch(error => error_notify(error))
},
async get_group_detail(group_pk) {
return await axios
.get(url+`groups/detail/${group_pk}/`)
.then(res => {
return {
status: res.status,
data: res.data
}
})
.catch(error => error_notify(error))
}
}
|