summaryrefslogtreecommitdiffstats
path: root/src/services/CommandsService.js
blob: e21c8f76e0fcc5c85bf696ca75fad9f33068b8b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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 {
            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')
            },
        }
    },

    logout() {
        AuthService.logout()
        store.dispatch('logout')
        router.push('/login')
    },
}