Browse Source

🔨 Move auto login to login page

main
Haris Razis 4 years ago
parent
commit
0b0b8d7fd3
  1. 11
      web/src/views/Home.vue
  2. 12
      web/src/views/Login.vue

11
web/src/views/Home.vue

@ -48,16 +48,5 @@ import ShapeDividerTop from '@/components/ShapeDividerTop.vue';
})
export default class Home extends Vue {
mounted() {
this.getCurrentUser();
}
private getCurrentUser() {
this.$store.dispatch('getCurrentUser')
.then(() => this.$router.push('/dashboard'))
.catch((err: any) => {
this.$router.push('/')
})
}
}
</script>

12
web/src/views/Login.vue

@ -55,6 +55,18 @@ export default class Login extends Vue {
private username = '';
private password = '';
mounted() {
this.getCurrentUser();
}
private getCurrentUser() {
this.$store.dispatch('getCurrentUser')
.then(() => this.$router.push('/dashboard'))
.catch((err: any) => {
this.$router.push('/')
})
}
private login() {
let user = {username: this.username, password: this.password}

Loading…
Cancel
Save