diff options
Diffstat (limited to 'src/services')
-rw-r--r-- | src/services/CommandsService.js | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/services/CommandsService.js b/src/services/CommandsService.js index e21c8f7..cc5bdf2 100644 --- a/src/services/CommandsService.js +++ b/src/services/CommandsService.js | |||
@@ -4,9 +4,20 @@ import store from "@/store/index.js" | |||
4 | import router from '@/router/index.js' | 4 | import router from '@/router/index.js' |
5 | 5 | ||
6 | function set_groups(data) { | 6 | function set_groups(data) { |
7 | return {[data.name.replace(" ", "_")]() {console.log(data.name)}} | 7 | function group_command(group) { |
8 | console.log(group) | ||
9 | } | ||
10 | |||
11 | let groups = {} | ||
12 | |||
13 | data.forEach((group) => { | ||
14 | groups[group.name] = () => group_command(group) | ||
15 | }) | ||
16 | |||
17 | return groups | ||
8 | } | 18 | } |
9 | 19 | ||
20 | |||
10 | export default { | 21 | export default { |
11 | groups() { | 22 | groups() { |
12 | return { | 23 | return { |
@@ -14,9 +25,8 @@ export default { | |||
14 | const {data, status} = await ChatService.get_all_user_groups() | 25 | const {data, status} = await ChatService.get_all_user_groups() |
15 | if (status!==200) | 26 | if (status!==200) |
16 | return {} | 27 | return {} |
17 | const test1 = set_groups(data[0]) | 28 | const groups = set_groups(data) |
18 | const test2 = set_groups(data[0]) | 29 | return groups |
19 | return {test1, test2} | ||
20 | }, | 30 | }, |
21 | 31 | ||
22 | make(searcher) { | 32 | make(searcher) { |