Untitled
unknown
javascript
5 months ago
1.1 kB
3
Indexable
import { defineStore } from 'pinia' export const usePasswordRequestStore = defineStore({ id: 'password-request', state: () => { return { form: { email: undefined }, loading: false } }, actions: { async onSubmit(form) { const api = useApi() const toast = useToast() this.loading = true try { const { message } = await api.post('/auth/password-reset/request', { body: { email: this.form.email } }) toast.add({ color: 'green', title: message, icon: 'i-heroicons-check-circle' }) this.$reset() } catch ({ response: { _data } }) { form.setErrors(_data.errors) } this.loading = false } } }) if (import.meta.hot) { import.meta.hot.accept(acceptHMRUpdate(usePasswordRequestStore, import.meta.hot)) }
Editor is loading...
Leave a Comment