From 10abd20260050174dd508038f0b95c5f8f740933 Mon Sep 17 00:00:00 2001 From: jdlugosz963 Date: Fri, 19 Nov 2021 09:57:58 +0100 Subject: fix bugs --- src/services/AuthService.js | 12 ++++++++++++ src/services/CommandsService.js | 32 ++++++++++++++------------------ 2 files changed, 26 insertions(+), 18 deletions(-) (limited to 'src/services') diff --git a/src/services/AuthService.js b/src/services/AuthService.js index ff1e468..758157c 100644 --- a/src/services/AuthService.js +++ b/src/services/AuthService.js @@ -5,6 +5,7 @@ const url = 'http://localhost:8000/api/auth/' const error_notify = (error) => { for (const [key, values] of Object.entries(error.response.data)) { + console.log(values) values.forEach(value => { Vue.notify({ type: 'error', @@ -43,5 +44,16 @@ export default { }) .catch(error => error_notify(error)) + }, + + async logout() { + return await axios + .post(url+'logout/') + .then(res => { + return { + status: res.status + } + }) + .catch(error => error_notify(error)) } } \ No newline at end of file diff --git a/src/services/CommandsService.js b/src/services/CommandsService.js index 1248c6d..f8a815f 100644 --- a/src/services/CommandsService.js +++ b/src/services/CommandsService.js @@ -1,24 +1,20 @@ +import AuthService from "./AuthService" +import store from "@/store/index.js" +import router from '@/router/index.js' + export default { logout() { - console.log("logout :)") + AuthService.logout() + store.dispatch('logout') + router.push('/login') }, - last_message() { - console.log("last massege") + friends() { + console.log("list") }, - chat() { + tab() { return { - search() {console.log("search")}, - add() {console.log("add friend")}, - next_tab() { - return { - hi_in_next_tab() { - console.log('Hello there! :)') - } - } - } - } - }, - notifications() {}, - users() {}, - groups() {} + on() {}, + off() {} + } + } } -- cgit v1.2.3