2018-03-08 09:41:39 +01:00
|
|
|
<template>
|
|
|
|
<div id="login">
|
|
|
|
<el-button type="primary" @click="login">Login</el-button>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
name: 'login',
|
2018-03-08 10:36:09 +01:00
|
|
|
created () {
|
|
|
|
this.$store.dispatch('Login/checkToken')
|
|
|
|
.catch(() => {
|
|
|
|
this.$message({
|
|
|
|
message: 'Please login',
|
|
|
|
type: 'error'
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.then(() => {
|
2018-03-08 11:53:14 +01:00
|
|
|
// redirect to home timeline
|
|
|
|
this.$router.push({ path: '/' })
|
2018-03-08 10:36:09 +01:00
|
|
|
})
|
|
|
|
},
|
2018-03-08 09:41:39 +01:00
|
|
|
methods: {
|
|
|
|
login () {
|
|
|
|
this.$store.dispatch('Login/fetchLogin')
|
|
|
|
.then((url) => {
|
|
|
|
this.$router.push({ path: '/authorize' })
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
#login {
|
|
|
|
text-align: center;
|
|
|
|
}
|
|
|
|
</style>
|