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:{
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,12 +142,13 @@ 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.isLogged = false
this.$router.push('/')
@ -153,6 +156,7 @@ export default {
},
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()
}
}

View File

@ -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()
}
}