summaryrefslogtreecommitdiffstats
path: root/src/services
diff options
context:
space:
mode:
authorjdlugosz963 <jdlugosz963@gmail.com>2021-11-19 09:57:58 +0100
committerjdlugosz963 <jdlugosz963@gmail.com>2021-11-19 09:57:58 +0100
commit10abd20260050174dd508038f0b95c5f8f740933 (patch)
treedfad854c6f510873ae3c12f21457fea1b0c9d72f /src/services
parent7f2f1e63826c0acb4514edfb1fbf7a884893f8c4 (diff)
downloadlom_frontend-10abd20260050174dd508038f0b95c5f8f740933.tar.gz
lom_frontend-10abd20260050174dd508038f0b95c5f8f740933.zip
fix bugs
Diffstat (limited to 'src/services')
-rw-r--r--src/services/AuthService.js12
-rw-r--r--src/services/CommandsService.js32
2 files changed, 26 insertions, 18 deletions
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/'
5 5
6const error_notify = (error) => { 6const error_notify = (error) => {
7 for (const [key, values] of Object.entries(error.response.data)) { 7 for (const [key, values] of Object.entries(error.response.data)) {
8 console.log(values)
8 values.forEach(value => { 9 values.forEach(value => {
9 Vue.notify({ 10 Vue.notify({
10 type: 'error', 11 type: 'error',
@@ -43,5 +44,16 @@ export default {
43 }) 44 })
44 .catch(error => error_notify(error)) 45 .catch(error => error_notify(error))
45 46
47 },
48
49 async logout() {
50 return await axios
51 .post(url+'logout/')
52 .then(res => {
53 return {
54 status: res.status
55 }
56 })
57 .catch(error => error_notify(error))
46 } 58 }
47} \ No newline at end of file 59} \ 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 @@
1import AuthService from "./AuthService"
2import store from "@/store/index.js"
3import router from '@/router/index.js'
4
1export default { 5export default {
2 logout() { 6 logout() {
3 console.log("logout :)") 7 AuthService.logout()
8 store.dispatch('logout')
9 router.push('/login')
4 }, 10 },
5 last_message() { 11 friends() {
6 console.log("last massege") 12 console.log("list")
7 }, 13 },
8 chat() { 14 tab() {
9 return { 15 return {
10 search() {console.log("search")}, 16 on() {},
11 add() {console.log("add friend")}, 17 off() {}
12 next_tab() { 18 }
13 return { 19 }
14 hi_in_next_tab() {
15 console.log('Hello there! :)')
16 }
17 }
18 }
19 }
20 },
21 notifications() {},
22 users() {},
23 groups() {}
24} 20}