przed pobieraniem kart z couchdb

This commit is contained in:
pawlaczyk 2019-01-13 04:20:41 +01:00
parent 0822d51a30
commit bbf84d7a35
2 changed files with 12 additions and 5 deletions

View File

@ -115,10 +115,12 @@ export default {
methods:{ methods:{
logout(){ logout(){
console.log("Procedura wylogowania wylogowania") console.log("Procedura wylogowania wylogowania")
var userLogin = localStorage.getItem('user') var userLogin = localStorage.getItem('user')
if (userLogin !== "" && userLogin !== "null"){ if (userLogin !== "" && userLogin !== "null"){
console.log("Mozna wylogowac: ", userLogin) console.log("Mozna wylogowac: ", userLogin)
var myVue = this
var myPromise = new Promise(function (resolve, reject){ var myPromise = new Promise(function (resolve, reject){
@ -140,19 +142,21 @@ export default {
myPromise.then(function(fromResolve){ myPromise.then(function(fromResolve){
console.log("Promise koniec: ", fromResolve) console.log("Promise koniec: ", fromResolve)
myVue.isLogged = false
}).catch(function(fromReject){ }).catch(function(fromReject){
console.log("No jakis bld przy wylogowaniu") console.log("No jakis bld przy wylogowaniu")
}) })
} }
// this.isLogged = false this.isLogged = false
this.$router.push('/') this.$router.push('/')
}, },
checkIsUserLogged(){ checkIsUserLogged(){
console.log("CREATE: ", localStorage.getItem('token') )
if (localStorage.getItem('token') === "null"){ //brak tokenu jest wylogowany if (localStorage.getItem('token') === "null"){ //brak tokenu jest wylogowany
this.isLogged = false this.isLogged = false
console.log("NIEZALOGOWANY") console.log("NIEZALOGOWANY")
@ -163,14 +167,12 @@ export default {
console.log("NIEZALOGOWANY") console.log("NIEZALOGOWANY")
return return
} }
console.log("JEST ZALOGOWANY")
this.isLogged = true
} }
}, },
created(){ created(){
console.log(this.isLogged) console.log(this.isLogged)
// this.checkIsUserLogged() this.checkIsUserLogged()
} }
} }

View File

@ -84,6 +84,10 @@ export default {
else{ else{
return this.userCards return this.userCards
} }
},
getUserCard(){
//pobieranie z bazy kard wylosowanych dla danego uzytkownika
localStorage.getItem('user')
} }
}, },
created(){ created(){
@ -103,6 +107,7 @@ export default {
console.log("LOCAL STOARAGE User: ", localStorage.getItem('user')) console.log("LOCAL STOARAGE User: ", localStorage.getItem('user'))
console.log("Wszyscy uzytkownicy: ", this.$store.getters.allUsers) console.log("Wszyscy uzytkownicy: ", this.$store.getters.allUsers)
this.getUserCard()
} }
} }