-
Notifications
You must be signed in to change notification settings - Fork 257
Expand file tree
/
Copy pathinstanceController.js
More file actions
89 lines (79 loc) · 1.86 KB
/
instanceController.js
File metadata and controls
89 lines (79 loc) · 1.86 KB
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
import http from "../http-common";
const fetchAll = async () => {
return await http
.get("/instance/fetchInstances")
.then((r) => r.data)
.catch((error) => {
throw error.response?.data || error.response || error;
});
};
const create = async (data) => {
return await http
.post("/instance/create", data)
.then((r) => r.data)
.catch((error) => {
throw error.response?.data || error.response || error;
});
}
const connect = async (instanceName) => {
return await http
.get("/instance/connect/:instance", {
params: {
instance: instanceName
}
})
.then((r) => r.data)
.catch((error) => {
throw error.response?.data || error.response || error;
});
}
const logout = async (instanceName) => {
return await http
.delete("/instance/logout/:instance", {
params: {
instance: instanceName
}
})
.then((r) => r.data)
.catch((error) => {
throw error.response?.data || error.response || error;
});
}
const restart = async (instanceName) => {
return await http
.put("/instance/restart/:instance", {}, {
params: {
instance: instanceName
}
})
.then((r) => r.data)
.catch((error) => {
throw error.response?.data || error.response || error;
});
}
const deleteInstance = async (instanceName) => {
return await http
.delete("/instance/delete/:instance", {
params: {
instance: instanceName
}
})
.then((r) => r.data)
.catch((error) => {
throw error.response?.data || error.response || error;
});
}
import settings from "./instanceSettingsController.js";
import group from "./instanceGroupController.js";
import chat from "./instanceChatController.js";
export default {
fetchAll,
create,
connect,
logout,
restart,
delete: deleteInstance,
...settings,
group,
chat
};