Delay loading animation (#8)
This commit is contained in:
parent
12f58bc1c6
commit
74455b058a
15 changed files with 112 additions and 58 deletions
|
|
@ -36,6 +36,7 @@
|
|||
import auth from '../../auth'
|
||||
import router from '../../router'
|
||||
import {HTTP} from '../../http-common'
|
||||
import message from '../../message'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
|
|
@ -53,15 +54,15 @@
|
|||
// Try to verify the email
|
||||
let emailVerifyToken = localStorage.getItem('emailConfirmToken')
|
||||
if (emailVerifyToken) {
|
||||
this.loading = true
|
||||
const cancel = message.setLoading(this)
|
||||
HTTP.post(`user/confirm`, {token: emailVerifyToken})
|
||||
.then(() => {
|
||||
localStorage.removeItem('emailConfirmToken')
|
||||
this.loading = false
|
||||
this.confirmedEmailSuccess = true
|
||||
cancel()
|
||||
})
|
||||
.catch(e => {
|
||||
this.loading = false
|
||||
cancel()
|
||||
this.error = e.response.data.message
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@
|
|||
|
||||
<script>
|
||||
import {HTTP} from '../../http-common'
|
||||
import message from '../../message'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
|
|
@ -53,11 +54,11 @@
|
|||
},
|
||||
methods: {
|
||||
submit() {
|
||||
this.loading = true
|
||||
const cancel = message.setLoading(this)
|
||||
this.error = ''
|
||||
|
||||
if (this.credentials.password2 !== this.credentials.password) {
|
||||
this.loading = false
|
||||
cancel()
|
||||
this.error = 'Passwords don\'t match'
|
||||
return
|
||||
}
|
||||
|
|
@ -71,17 +72,17 @@
|
|||
.then(response => {
|
||||
this.handleSuccess(response)
|
||||
localStorage.removeItem('passwordResetToken')
|
||||
cancel()
|
||||
})
|
||||
.catch(e => {
|
||||
this.error = e.response.data.message
|
||||
cancel()
|
||||
})
|
||||
},
|
||||
handleError(e) {
|
||||
this.loading = false
|
||||
this.error = e.response.data.message
|
||||
},
|
||||
handleSuccess(e) {
|
||||
this.loading = false
|
||||
this.successMessage = e.data.message
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
|
||||
<script>
|
||||
import {HTTP} from '../../http-common'
|
||||
import message from '../../message'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
|
|
@ -43,7 +44,7 @@
|
|||
},
|
||||
methods: {
|
||||
submit() {
|
||||
this.loading = true
|
||||
const cancel = message.setLoading(this)
|
||||
this.error = ''
|
||||
let credentials = {
|
||||
user_name: this.username,
|
||||
|
|
@ -51,15 +52,15 @@
|
|||
|
||||
HTTP.post(`user/password/token`, credentials)
|
||||
.then(() => {
|
||||
this.loading = false
|
||||
cancel()
|
||||
this.isSuccess = true
|
||||
})
|
||||
.catch(e => {
|
||||
cancel()
|
||||
this.handleError(e)
|
||||
})
|
||||
},
|
||||
handleError(e) {
|
||||
this.loading = false
|
||||
this.error = e.response.data.message
|
||||
},
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue