Skip to content

Commit

Permalink
chore: connect forgot to backend
Browse files Browse the repository at this point in the history
  • Loading branch information
hywax committed Aug 5, 2024
1 parent 0e27fe0 commit afb983f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
18 changes: 10 additions & 8 deletions apps/web/app/pages/auth/forgot.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
<UInput v-model="state.email" type="email" size="md" :placeholder="$t('auth.form.email.placeholder')" />
</UFormGroup>

<UButton type="submit" size="md" block>
<UButton type="submit" size="md" :loading="status === 'pending'" block>
{{ $t('auth.form.action.forgot') }}
</UButton>
</UForm>
</div>
</template>

<script setup lang="ts">
import type { Form, FormSubmitEvent } from '#ui/types'
import type { Form } from '#ui/types'
import { type AuthForgotSchema, authForgotSchema } from '#schema'
definePageMeta({
Expand All @@ -38,17 +38,19 @@ useHead({
title: () => $t('auth.forgot.title'),
})
const { onChangeLocale } = useI18nUtils()
const form = ref<Form<AuthForgotSchema>>()
const state = reactive({
email: '',
email: 'test@ta.ru',
})
function onSubmit(_event: FormSubmitEvent<AuthForgotSchema>) {
}
const { status, execute: onSubmit } = useAPI('/api/auth/forgot', {
method: 'POST',
body: state,
immediate: false,
watch: false,
})
const { onChangeLocale } = useI18nUtils()
onChangeLocale(() => {
form.value?.clear()
})
Expand Down
2 changes: 0 additions & 2 deletions apps/web/app/schema/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ export const authRegisterSchema = z.object({
})

export const authForgotSchema = z.object({
name: z.string().min(3),
email: z.string().email(),
password: z.string().min(6),
})

export type AuthLoginSchema = z.input<typeof authLoginSchema>
Expand Down

0 comments on commit afb983f

Please sign in to comment.