after login go to redeem page

This commit is contained in:
ogerly 2022-03-21 14:38:08 +01:00
parent 1baf855265
commit 7850127ae2
2 changed files with 5 additions and 42 deletions

View File

@ -42,10 +42,6 @@
</validation-observer>
</b-card-body>
</b-card>
<div v-if="$route.params.code" class="mt-2 mb-2">
{{ $t('gdd_per_link.redeem') + ':' }}
<b>{{ $route.params.code }}</b>
</div>
<b-row class="mt-3">
<b-col cols="6" class="text-center text-sm-left col-12 col-sm-6 pb-5">
<router-link to="/forgot-password" class="mt-3">
@ -68,7 +64,6 @@ import InputPassword from '@/components/Inputs/InputPassword'
import InputEmail from '@/components/Inputs/InputEmail'
import { login } from '@/graphql/queries'
import { getCommunityInfoMixin } from '@/mixins/getCommunityInfo'
import { redeemTransactionLink } from '@/graphql/mutations'
export default {
name: 'Login',
@ -101,16 +96,17 @@ export default {
},
fetchPolicy: 'network-only',
})
.then((result) => {
.then(async (result) => {
const {
data: { login },
} = result
this.$store.dispatch('login', login)
await loader.hide()
if (this.$route.params.code) {
this.redeemLink(this.$route.params.code)
this.$router.push(`/redeem/${this.$route.params.code}`)
} else {
this.$router.push('/overview')
}
this.$router.push('/overview')
loader.hide()
})
.catch((error) => {
this.toastError(this.$t('error.no-account'))
@ -122,21 +118,6 @@ export default {
loader.hide()
})
},
redeemLink(code) {
this.$apollo
.mutate({
mutation: redeemTransactionLink,
variables: {
code: code,
},
})
.then(() => {
this.toastSuccess(this.$t('gdd_per_link.successfully-redeemed'))
})
.catch((err) => {
this.toastError(err.message)
})
},
},
}
</script>

View File

@ -118,24 +118,6 @@
{{ messageError }}
</span>
</b-alert>
<b-row v-if="redeemCode">
<b-col>
<label>{{ $t('gdd_per_link.redeem') }}</label>
<div class="mt-2 mb-2">
<b-input-group class="shadow-sm p-2 bg-white rounded">
<b-input-group-prepend is-text>
<b-icon icon="link45deg"></b-icon>
</b-input-group-prepend>
<b-form-input
readonly
id="redeem-code"
type="text"
v-model="redeemCode"
></b-form-input>
</b-input-group>
</div>
</b-col>
</b-row>
<b-row
v-else