From 98bec5686da0c4b7d0279b94968040b01e3218fa Mon Sep 17 00:00:00 2001 From: jdlugosz963 Date: Mon, 13 Dec 2021 15:21:21 +0100 Subject: add group searcher dont work for now --- src/services/ChatService.js | 12 ++++++++++++ src/services/CommandsService.js | 14 +++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) (limited to 'src/services') 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 { } }) .catch(error => error_notify(error)) + }, + + async get_all_user_groups() { + return await axios + .get(url+'groups/') + .then(res => { + return { + status: res.status, + data: res.data + } + }) + .catch(error => error_notify(error)) } } 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 @@ import AuthService from "./AuthService" +import ChatService from "./ChatService" import store from "@/store/index.js" import router from '@/router/index.js' +function set_groups(data) { + return {[data.name.replace(" ", "_")]() {console.log(data.name)}} +} + export default { groups() { return { - send(searcher) {console.log(searcher)}, + async send() { + 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} + }, make(searcher) { searcher.$emit('toogle_group_maker') -- cgit v1.2.3