implement default actions

This commit is contained in:
Tim Zieger 2020-05-25 12:10:02 +02:00
parent edd7317aa4
commit 2a68777f67
2 changed files with 22 additions and 4 deletions

View File

@ -50,7 +50,7 @@
<!-- Top menu bar --> <!-- Top menu bar -->
<v-app-bar app clipped-left class="main" elevation="10"> <v-app-bar app clipped-left class="main" elevation="10">
<v-app-bar-nav-icon @click.stop="drawer = !drawer" /> <v-app-bar-nav-icon @click.stop="drawer = !drawer" />
<v-img src="./assets/logo.svg" max-height="100%" max-width="100" contain></v-img> <v-img @click="forward" src="./assets/logo.svg" max-height="100%" max-width="100" contain></v-img>
<v-toolbar-title>Geo Timetracking</v-toolbar-title> <v-toolbar-title>Geo Timetracking</v-toolbar-title>
<v-spacer></v-spacer> <v-spacer></v-spacer>
@ -160,6 +160,9 @@ export default {
role: sessionStorage.getItem("role") role: sessionStorage.getItem("role")
}), }),
methods: { methods: {
forward() {
this.$router.push("/")
},
signIn(loginData) { signIn(loginData) {
var xhttp = new XMLHttpRequest(); var xhttp = new XMLHttpRequest();

View File

@ -10,7 +10,7 @@
<v-card-text class="mt-1"> <v-card-text class="mt-1">
<h1 class="text-center display-2 logowhite--text">Sign in</h1> <h1 class="text-center display-2 logowhite--text">Sign in</h1>
<v-form> <v-form>
<v-text-field <v-text-field
label="Username" label="Username"
v-model="username" v-model="username"
@ -32,7 +32,7 @@
<p id="missing"></p> <p id="missing"></p>
</v-card-text> </v-card-text>
<div class="text-center mt-3"> <div class="text-center mt-3">
<v-btn rounded color="logowhite" outlined dark v-on:click="signin()">Sign In</v-btn> <v-btn rounded color="logowhite" outlined dark v-on:click="signin()" >Sign In</v-btn>
</div> </div>
</v-col> </v-col>
<v-col cols="12" md="4" class="main"> <v-col cols="12" md="4" class="main">
@ -112,7 +112,7 @@
<p id="missingR"></p> <p id="missingR"></p>
</v-card-text> </v-card-text>
<div class="text-center mt-n5"> <div class="text-center mt-n5">
<v-btn color="logowhite" rounded outlined v-on:click="signup()">Sign Up</v-btn> <v-btn color="logowhite" rounded outlined v-on:click="signup()" >Sign Up</v-btn>
</div> </div>
</v-col> </v-col>
</v-row> </v-row>
@ -125,6 +125,7 @@
</template> </template>
<script> <script>
export default { export default {
data: () => ({ data: () => ({
step: 1, step: 1,
@ -168,6 +169,20 @@ export default {
document.getElementById("missingR").innerHTML= "Please fill out all fields"; document.getElementById("missingR").innerHTML= "Please fill out all fields";
} }
} }
},
mounted(){
window.addEventListener('keyup', (e) => {
if (e.keyCode === 13) {
e.preventDefault();
if(this.step==1){
this.signin();
}else{
this.signup();
}
}
});
} }
}; };
</script> </script>