From 193a6b59425ab45004f4178fc3f5b5bad5b4c660 Mon Sep 17 00:00:00 2001 From: jdlugosz963 Date: Tue, 14 Dec 2021 06:22:57 +0100 Subject: make group searcher works --- src/services/CommandsService.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'src/services') 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" import router from '@/router/index.js' function set_groups(data) { - return {[data.name.replace(" ", "_")]() {console.log(data.name)}} + function group_command(group) { + console.log(group) + } + + let groups = {} + + data.forEach((group) => { + groups[group.name] = () => group_command(group) + }) + + return groups } + export default { groups() { return { @@ -14,9 +25,8 @@ export default { const {data, status} = await ChatService.get_all_user_groups() if (status!==200) return {} - const test1 = set_groups(data[0]) - const test2 = set_groups(data[0]) - return {test1, test2} + const groups = set_groups(data) + return groups }, make(searcher) { -- cgit v1.2.3