Snackabry do logowania i wylogowania

This commit is contained in:
pawlaczyk 2019-01-05 22:08:36 +01:00
parent 8b19247175
commit d023900d73

View File

@ -7,6 +7,20 @@
</v-btn>
</v-snackbar>
<v-snackbar v-model="snackbarLogout" :timeout="4000" top color="primary success-text">
<span>Wylogowano</span>
<v-btn flat color="white" @click="snackbarLogout = false">
<v-icon>clear</v-icon>
</v-btn>
</v-snackbar>
<v-snackbar v-model="snackbarLogin" :timeout="4000" top color="primary success-text">
<span>Poprawnie zalogowano</span>
<v-btn flat color="white" @click="snackbarLogin = false">
<v-icon>clear</v-icon>
</v-btn>
</v-snackbar>
<v-toolbar flat app>
<v-toolbar-side-icon class="grey--text" @click="drawer = !drawer">
<!-- burger menu icon, color zmieniony jak na ten tekstu -->
@ -33,8 +47,9 @@
</v-list>
</v-menu>
<v-btn flat color="grey" @click="userLogout">
<span>Sign Out</span>
<v-btn flat color="grey" @click="userAction">
<span v-if="isLogged">Wyjdź</span>
<span v-if="!isLogged">Zaloguj</span>
<v-icon right>exit_to_app</v-icon>
</v-btn>
</v-toolbar>
@ -77,7 +92,10 @@ export default {
data(){
return{
drawer: false, //niepokazywac na poczatku
snackbar: false
snackbar: false,
snackbarLogout: false,
isLogged: true,
snackbarLogint: false
}
},
computed:{
@ -86,9 +104,18 @@ export default {
}
},
methods:{
userLogout(){
//wylogowanie
console.log("wylogowano")
userAction(){
if(this.isLogged){
this.snackbarLogout = true
this.isLogged = false
console.log("wylogowano")
}
else{
this.snackbarLogout = false
this.snackbarLogin = true
this.isLogged = true
console.log("zalogowano")
}
}
}