diff options
author | jdlugosz963 <jdlugosz963@gmail.com> | 2021-12-14 06:22:57 +0100 |
---|---|---|
committer | jdlugosz963 <jdlugosz963@gmail.com> | 2021-12-14 06:22:57 +0100 |
commit | 193a6b59425ab45004f4178fc3f5b5bad5b4c660 (patch) | |
tree | 334bdb11345889967c45888bb11a129b03a67697 /src/services | |
parent | 98bec5686da0c4b7d0279b94968040b01e3218fa (diff) | |
download | lom_frontend-193a6b59425ab45004f4178fc3f5b5bad5b4c660.tar.gz lom_frontend-193a6b59425ab45004f4178fc3f5b5bad5b4c660.zip |
make group searcher works
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) { |