chore: better function naming in password components
This commit is contained in:
parent
795b26e1dd
commit
a416d26f7c
@ -11,17 +11,17 @@
|
|||||||
{{ $t('user.auth.login') }}
|
{{ $t('user.auth.login') }}
|
||||||
</x-button>
|
</x-button>
|
||||||
</div>
|
</div>
|
||||||
<form @submit.prevent="submit" id="form" v-if="!successMessage">
|
<form @submit.prevent="resetPassword" id="form" v-if="!successMessage">
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label class="label" for="password">{{ $t('user.auth.password') }}</label>
|
<label class="label" for="password">{{ $t('user.auth.password') }}</label>
|
||||||
<Password @submit="submit" @update:modelValue="v => credentials.password = v"/>
|
<Password @submit="resetPassword" @update:modelValue="v => credentials.password = v"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="field is-grouped">
|
<div class="field is-grouped">
|
||||||
<div class="control">
|
<div class="control">
|
||||||
<x-button
|
<x-button
|
||||||
:loading="passwordResetService.loading"
|
:loading="passwordResetService.loading"
|
||||||
@click="submit"
|
@click="resetPassword"
|
||||||
>
|
>
|
||||||
{{ $t('user.auth.resetPassword') }}
|
{{ $t('user.auth.resetPassword') }}
|
||||||
</x-button>
|
</x-button>
|
||||||
@ -47,7 +47,7 @@ const passwordResetService = reactive(new PasswordResetService())
|
|||||||
const errorMsg = ref('')
|
const errorMsg = ref('')
|
||||||
const successMessage = ref('')
|
const successMessage = ref('')
|
||||||
|
|
||||||
async function submit() {
|
async function resetPassword() {
|
||||||
errorMsg.value = ''
|
errorMsg.value = ''
|
||||||
|
|
||||||
if(credentials.password === '') {
|
if(credentials.password === '') {
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
{{ $t('user.auth.login') }}
|
{{ $t('user.auth.login') }}
|
||||||
</x-button>
|
</x-button>
|
||||||
</div>
|
</div>
|
||||||
<form @submit.prevent="submit" v-if="!isSuccess">
|
<form @submit.prevent="requestPasswordReset" v-if="!isSuccess">
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label class="label" for="email">{{ $t('user.auth.email') }}</label>
|
<label class="label" for="email">{{ $t('user.auth.email') }}</label>
|
||||||
<div class="control">
|
<div class="control">
|
||||||
@ -30,7 +30,7 @@
|
|||||||
<div class="field is-grouped">
|
<div class="field is-grouped">
|
||||||
<div class="control">
|
<div class="control">
|
||||||
<x-button
|
<x-button
|
||||||
@click="submit"
|
type="submit"
|
||||||
:loading="passwordResetService.loading"
|
:loading="passwordResetService.loading"
|
||||||
>
|
>
|
||||||
{{ $t('user.auth.resetPasswordAction') }}
|
{{ $t('user.auth.resetPasswordAction') }}
|
||||||
@ -45,19 +45,18 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {ref, reactive} from 'vue'
|
import {ref, shallowReactive} from 'vue'
|
||||||
|
|
||||||
import PasswordResetModel from '@/models/passwordReset'
|
import PasswordResetModel from '@/models/passwordReset'
|
||||||
import PasswordResetService from '@/services/passwordReset'
|
import PasswordResetService from '@/services/passwordReset'
|
||||||
import Message from '@/components/misc/message.vue'
|
import Message from '@/components/misc/message.vue'
|
||||||
|
|
||||||
// Not sure if this instance needs a shalloRef at all
|
const passwordResetService = shallowReactive(new PasswordResetService())
|
||||||
const passwordResetService = reactive(new PasswordResetService())
|
|
||||||
const passwordReset = ref(new PasswordResetModel())
|
const passwordReset = ref(new PasswordResetModel())
|
||||||
const errorMsg = ref('')
|
const errorMsg = ref('')
|
||||||
const isSuccess = ref(false)
|
const isSuccess = ref(false)
|
||||||
|
|
||||||
async function submit() {
|
async function requestPasswordReset() {
|
||||||
errorMsg.value = ''
|
errorMsg.value = ''
|
||||||
try {
|
try {
|
||||||
await passwordResetService.requestResetPassword(passwordReset.value)
|
await passwordResetService.requestResetPassword(passwordReset.value)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user