Follow @mattwr18 suggetions don't enter mail twice

This commit is contained in:
Robert Schäfer 2019-06-20 15:12:26 +02:00
parent 9dd340c69b
commit ff46740e90
5 changed files with 16 additions and 21 deletions

View File

@ -69,7 +69,7 @@ describe('Request', () => {
beforeEach(jest.runAllTimers)
it('emits `handleSubmitted`', () => {
expect(wrapper.emitted('handleSubmitted')).toBeTruthy()
expect(wrapper.emitted('handleSubmitted')).toEqual([[{ email: 'mail@example.org' }]])
})
})
})

View File

@ -89,14 +89,14 @@ export default {
requestPasswordReset(email: $email)
}
`
const variables = this.formData
const { email } = this.formData
try {
await this.$apollo.mutate({ mutation, variables })
await this.$apollo.mutate({ mutation, variables: { email } })
this.submitted = true
setTimeout(() => {
this.$emit('handleSubmitted')
this.$emit('handleSubmitted', { email })
}, 3000)
} catch (err) {
this.$toast.error(err.message)

View File

@ -8,13 +8,6 @@
@input="handleInput"
@input-valid="handleInputValid"
>
<ds-input
:placeholder="$t('login.email')"
model="email"
id="email"
name="email"
icon="envelope"
/>
<ds-input
:placeholder="$t('verify-code.form.code')"
model="code"
@ -37,18 +30,15 @@
<script>
export default {
props: {
email: { type: String, required: true },
},
data() {
return {
formData: {
email: '',
code: '',
},
formSchema: {
email: {
type: 'email',
required: true,
message: this.$t('common.validations.email'),
},
code: {
type: 'string',
min: 6,
@ -68,7 +58,8 @@ export default {
this.disabled = false
},
handleSubmitVerify() {
const { email, code } = this.formData
const { code } = this.formData
const email = this.email
this.$emit('verification', { email, code })
},
},

View File

@ -10,8 +10,8 @@ export default {
Request,
},
methods: {
handlePasswordResetRequested() {
this.$router.push('verify-code')
handlePasswordResetRequested({ email }) {
this.$router.push({ path: 'verify-code', query: { email } })
},
},
}

View File

@ -1,5 +1,5 @@
<template>
<verify-code @verification="handleVerification" />
<verify-code :email="email" @verification="handleVerification" />
</template>
<script>
@ -9,6 +9,10 @@ export default {
components: {
VerifyCode,
},
data() {
const { email = '' } = this.$route.query
return { email }
},
methods: {
handleVerification({ email, code }) {
this.$router.push({ path: 'change-password', query: { email, code } })