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 { 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> </script>

12
web/src/views/Login.vue

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

Loading…
Cancel
Save