Add query to the queries file, add method that checks if optin code is valid else push to password reset page.

This commit is contained in:
elweyn 2022-03-14 12:33:57 +01:00
parent 4105191b04
commit 21504e8005
2 changed files with 22 additions and 0 deletions

View File

@ -127,3 +127,9 @@ export const communities = gql`
}
}
`
export const queryOptIn = gql`
query($optIn: String!) {
queryOptIn(optIn: $optIn)
}
`

View File

@ -46,6 +46,7 @@
<script>
import InputPasswordConfirmation from '@/components/Inputs/InputPasswordConfirmation'
import { setPassword } from '@/graphql/mutations'
import { queryOptIn } from '@/graphql/queries'
const textFields = {
reset: {
@ -104,7 +105,22 @@ export default {
this.$router.push('/forgot-password/resetPassword')
})
},
checkOptInCode() {
this.$apollo
.query({
query: queryOptIn,
variables: {
optIn: this.$route.params.optin,
},
})
.then()
.catch((error) => {
this.toastError(error.message)
this.$router.push('/forgot-password/resetPassword')
})
},
setDisplaySetup() {
this.checkOptInCode()
if (this.$route.path.includes('checkEmail')) {
this.displaySetup = textFields.checkEmail
}