diff options
Diffstat (limited to 'src/services')
-rw-r--r-- | src/services/ChatService.js | 12 | ||||
-rw-r--r-- | src/services/CommandsService.js | 14 |
2 files changed, 25 insertions, 1 deletions
diff --git a/src/services/ChatService.js b/src/services/ChatService.js index ab1e6c2..08deba2 100644 --- a/src/services/ChatService.js +++ b/src/services/ChatService.js | |||
@@ -13,5 +13,17 @@ export default { | |||
13 | } | 13 | } |
14 | }) | 14 | }) |
15 | .catch(error => error_notify(error)) | 15 | .catch(error => error_notify(error)) |
16 | }, | ||
17 | |||
18 | async get_all_user_groups() { | ||
19 | return await axios | ||
20 | .get(url+'groups/') | ||
21 | .then(res => { | ||
22 | return { | ||
23 | status: res.status, | ||
24 | data: res.data | ||
25 | } | ||
26 | }) | ||
27 | .catch(error => error_notify(error)) | ||
16 | } | 28 | } |
17 | } | 29 | } |
diff --git a/src/services/CommandsService.js b/src/services/CommandsService.js index 01a758e..e21c8f7 100644 --- a/src/services/CommandsService.js +++ b/src/services/CommandsService.js | |||
@@ -1,11 +1,23 @@ | |||
1 | import AuthService from "./AuthService" | 1 | import AuthService from "./AuthService" |
2 | import ChatService from "./ChatService" | ||
2 | import store from "@/store/index.js" | 3 | import store from "@/store/index.js" |
3 | import router from '@/router/index.js' | 4 | import router from '@/router/index.js' |
4 | 5 | ||
6 | function set_groups(data) { | ||
7 | return {[data.name.replace(" ", "_")]() {console.log(data.name)}} | ||
8 | } | ||
9 | |||
5 | export default { | 10 | export default { |
6 | groups() { | 11 | groups() { |
7 | return { | 12 | return { |
8 | send(searcher) {console.log(searcher)}, | 13 | async send() { |
14 | const {data, status} = await ChatService.get_all_user_groups() | ||
15 | if (status!==200) | ||
16 | return {} | ||
17 | const test1 = set_groups(data[0]) | ||
18 | const test2 = set_groups(data[0]) | ||
19 | return {test1, test2} | ||
20 | }, | ||
9 | 21 | ||
10 | make(searcher) { | 22 | make(searcher) { |
11 | searcher.$emit('toogle_group_maker') | 23 | searcher.$emit('toogle_group_maker') |