mirror of
https://github.com/bartvdbraak/omnidash.git
synced 2025-04-27 15:31:21 +00:00
refactor: login form event handlers
This commit is contained in:
parent
b95766ea4b
commit
d4ad7dd203
1 changed files with 13 additions and 3 deletions
|
@ -30,12 +30,22 @@
|
||||||
},
|
},
|
||||||
onUpdated: ({ form: f }) => {
|
onUpdated: ({ form: f }) => {
|
||||||
isLoading = false;
|
isLoading = false;
|
||||||
if (f.valid) {
|
if (!f.valid) {
|
||||||
toast.success('Succesfully logged in.');
|
|
||||||
} else {
|
|
||||||
toast.error('Please fix the errors.');
|
toast.error('Please fix the errors.');
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
onError: (e) => {
|
||||||
|
toast.error(e.result.error.message);
|
||||||
|
},
|
||||||
|
onResult: (e) => {
|
||||||
|
if (e.result.status === 303) {
|
||||||
|
toast.success('Logged in successfully.');
|
||||||
|
} else {
|
||||||
|
console.log(e)
|
||||||
|
toast.error('Invalid credentials.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const { form: formData, enhance } = form;
|
const { form: formData, enhance } = form;
|
||||||
|
|
Loading…
Reference in a new issue