mirror of
https://github.com/bartvdbraak/omnidash.git
synced 2025-04-27 07:21:20 +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 }) => {
|
||||
isLoading = false;
|
||||
if (f.valid) {
|
||||
toast.success('Succesfully logged in.');
|
||||
} else {
|
||||
if (!f.valid) {
|
||||
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;
|
||||
|
|
Loading…
Reference in a new issue