From bbf84d7a3589f84bdf024bf09834676d20381684 Mon Sep 17 00:00:00 2001 From: pawlaczyk Date: Sun, 13 Jan 2019 04:20:41 +0100 Subject: [PATCH] przed pobieraniem kart z couchdb --- frontend/app/src/components/Navbar.vue | 12 +++++++----- frontend/app/src/views/Game.vue | 5 +++++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/frontend/app/src/components/Navbar.vue b/frontend/app/src/components/Navbar.vue index 56af14c..5d48a34 100644 --- a/frontend/app/src/components/Navbar.vue +++ b/frontend/app/src/components/Navbar.vue @@ -115,10 +115,12 @@ export default { methods:{ logout(){ + console.log("Procedura wylogowania wylogowania") var userLogin = localStorage.getItem('user') if (userLogin !== "" && userLogin !== "null"){ console.log("Mozna wylogowac: ", userLogin) + var myVue = this var myPromise = new Promise(function (resolve, reject){ @@ -140,19 +142,21 @@ export default { myPromise.then(function(fromResolve){ console.log("Promise koniec: ", fromResolve) + myVue.isLogged = false }).catch(function(fromReject){ console.log("No jakis bld przy wylogowaniu") }) } - // this.isLogged = false - this.$router.push('/') + this.isLogged = false + this.$router.push('/') }, checkIsUserLogged(){ + console.log("CREATE: ", localStorage.getItem('token') ) if (localStorage.getItem('token') === "null"){ //brak tokenu jest wylogowany this.isLogged = false console.log("NIEZALOGOWANY") @@ -163,14 +167,12 @@ export default { console.log("NIEZALOGOWANY") return } - console.log("JEST ZALOGOWANY") - this.isLogged = true } }, created(){ console.log(this.isLogged) - // this.checkIsUserLogged() + this.checkIsUserLogged() } } diff --git a/frontend/app/src/views/Game.vue b/frontend/app/src/views/Game.vue index 1deb8e9..0a9ef82 100644 --- a/frontend/app/src/views/Game.vue +++ b/frontend/app/src/views/Game.vue @@ -84,6 +84,10 @@ export default { else{ return this.userCards } + }, + getUserCard(){ + //pobieranie z bazy kard wylosowanych dla danego uzytkownika + localStorage.getItem('user') } }, created(){ @@ -103,6 +107,7 @@ export default { console.log("LOCAL STOARAGE User: ", localStorage.getItem('user')) console.log("Wszyscy uzytkownicy: ", this.$store.getters.allUsers) + this.getUserCard() } }