[Popup]dodawanie nowej karty tylko dla zalogowanego uzytkkownika

This commit is contained in:
pawlaczyk 2019-01-12 23:42:14 +01:00
parent 1e13abc752
commit b782f39ed8
2 changed files with 66 additions and 42 deletions

View File

@ -7,6 +7,13 @@
</v-btn> </v-btn>
</v-snackbar> </v-snackbar>
<v-snackbar v-model="snackbarLoginRequred" :timeout="4000" top color="primary success-text">
<span>Wymagane logowanie!</span>
<v-btn flat color="white" @click="snackbar = false">
<v-icon>clear</v-icon>
</v-btn>
</v-snackbar>
<v-snackbar v-model="snackbarLogout" :timeout="4000" top color="primary success-text"> <v-snackbar v-model="snackbarLogout" :timeout="4000" top color="primary success-text">
<span>Wylogowano</span> <span>Wylogowano</span>
<v-btn flat color="white" @click="snackbarLogout = false"> <v-btn flat color="white" @click="snackbarLogout = false">
@ -67,7 +74,7 @@
<p class="white--text mt-3 subheading">Edżentelmeni</p> <p class="white--text mt-3 subheading">Edżentelmeni</p>
</v-flex> </v-flex>
<v-flex class="mb-3"> <v-flex class="mb-3">
<Popup @cardAdded="snackbar = true"/> <Popup @cardAdded="snackbar = true" @LoginRequired="snackbarLoginRequred = true"/>
</v-flex> </v-flex>
</v-layout> </v-layout>
@ -96,7 +103,8 @@ export default {
snackbar: false, snackbar: false,
snackbarLogout: false, snackbarLogout: false,
isLogged: true, isLogged: true,
snackbarLogin: false snackbarLogin: false,
snackbarLoginRequred: false,
} }
}, },
computed:{ computed:{

View File

@ -56,6 +56,21 @@ export default {
"Blank" :1 , "Blank" :1 ,
"texst": "ALA MA KOTA" "texst": "ALA MA KOTA"
}*/ }*/
if (localStorage.getItem('token') === "null"){
this.isLogged = true
console.log("TUTAJ: ", localStorage.getItem('token') === null)
this.$router.push('/')
this.$emit('LoginRequired')
return
}
if(localStorage.getItem('token') === null){
console.log("TUTAJ: ", localStorage.getItem('token') === null)
this.$router.push('/')
this.$emit('LoginRequired')
return
}
else{ //Dodawanie tylko dla zalogowanych
console.log("DODAWANIE KARTY")
if (this.$refs.form.validate()){ // valinnaj JS if (this.$refs.form.validate()){ // valinnaj JS
var blank = 0 var blank = 0
@ -100,6 +115,7 @@ export default {
} ///dlugi if } ///dlugi if
} }
}
}, },
computed:{ computed:{
formattedDate(){ formattedDate(){