Changeset View
Changeset View
Standalone View
Standalone View
src/resources/vue/components/Login.vue
Show All 16 Lines | |||||
</template> | </template> | ||||
<script> | <script> | ||||
export default { | export default { | ||||
data() { | data() { | ||||
return { | return { | ||||
email: '', | email: '', | ||||
password: '', | password: '', | ||||
loginError: false, | loginError: false | ||||
} | } | ||||
}, | }, | ||||
methods: { | methods: { | ||||
submitLogin() { | submitLogin() { | ||||
this.loginError = false; | this.loginError = false | ||||
axios.post('/api/auth/login', { | axios.post('/api/auth/login', { | ||||
email: this.email, | email: this.email, | ||||
password: this.password | password: this.password | ||||
}).then(response => { | }).then(response => { | ||||
// login user and redirect to dashboard | // login user and redirect to dashboard | ||||
this.$root.loginUser(response.data.access_token) | this.$root.loginUser(response.data.access_token) | ||||
}).catch(error => { | }).catch(error => { | ||||
this.loginError = true | this.loginError = true | ||||
▲ Show 20 Lines • Show All 45 Lines • Show Last 20 Lines |