FitTrackee/fittrackee_client/src/views/user/PasswordResetView.vue

56 lines
1.2 KiB
Vue
Raw Normal View History

2021-10-20 17:38:25 +02:00
<template>
2021-11-03 09:10:23 +01:00
<div id="password-reset" class="view">
2021-10-20 17:38:25 +02:00
<div class="container">
<PasswordResetRequest
v-if="action.startsWith('reset')"
:action="action"
:token="token"
/>
<PasswordEmailSent v-else :action="action" />
</div>
</div>
</template>
<script setup lang="ts">
import { computed, toRefs, onBeforeMount } from 'vue'
2021-10-20 17:38:25 +02:00
import { useRoute, useRouter } from 'vue-router'
import PasswordEmailSent from '@/components/User/PasswordReset/PasswordActionDone.vue'
import PasswordResetRequest from '@/components/User/PasswordReset/PasswordResetForm.vue'
interface Props {
action: string
}
const props = defineProps<Props>()
const route = useRoute()
const router = useRouter()
2021-10-20 17:38:25 +02:00
const { action } = toRefs(props)
const token = computed(() => route.query.token)
onBeforeMount(() => {
if (props.action === 'reset' && !token.value) {
router.push('/')
}
2021-10-20 17:38:25 +02:00
})
</script>
<style lang="scss" scoped>
@import '~@/scss/base.scss';
#password-reset {
display: flex;
.container {
display: flex;
justify-content: center;
width: 50%;
@media screen and (max-width: $small-limit) {
width: 100%;
margin: 0 auto 50px auto;
}
}
}
</style>