Skip to content

Commit

Permalink
Merge pull request #611 from yeatmanlab/error-catching-administration
Browse files Browse the repository at this point in the history
Adding toast feedback for errors with creating an administration
  • Loading branch information
richford committed May 24, 2024
2 parents 75e5b6e + 9aeae35 commit 385d3ea
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 17 deletions.
34 changes: 20 additions & 14 deletions src/components/CreateAdministration.vue
Original file line number Diff line number Diff line change
Expand Up @@ -496,21 +496,27 @@ const submit = async () => {
if (isTestData.value) args.isTestData = true;
if (props.adminId) args.administrationId = props.adminId;
await roarfirekit.value.createAdministration(args).then(() => {
toast.add({
severity: 'success',
summary: 'Success',
detail: props.adminId ? 'Administration updated' : 'Administration created',
life: 3000,
await roarfirekit.value
.createAdministration(args)
.then(() => {
toast.add({
severity: 'success',
summary: 'Success',
detail: props.adminId ? 'Administration updated' : 'Administration created',
life: 3000,
});
administrationQueryKeyIndex.value += 1;
// TODO: Invalidate for administrations query.
// This does not work in prod for some reason.
// queryClient.invalidateQueries({ queryKey: ['administrations'] })
router.push({ name: 'Home' });
})
.catch((error) => {
toast.add({ severity: 'error', summary: 'Error', detail: error.message, life: 3000 });
console.error('Error creating administration:', error.message);
});
administrationQueryKeyIndex.value += 1;
// TODO: Invalidate for administrations query.
// This does not work in prod for some reason.
// queryClient.invalidateQueries({ queryKey: ['administrations'] })
router.push({ name: 'Home' });
});
} else {
console.log('need at least one org');
orgError.value = 'At least one organization needs to be selected.';
Expand Down
4 changes: 2 additions & 2 deletions src/components/CreateOrgs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ const submit = async () => {
})
.catch((error) => {
toast.add({ severity: 'error', summary: 'Error', detail: error.message, life: 3000 });
console.error('Error creating org', error);
console.error('Error creating org:', error);
});
} else {
await roarfirekit.value
Expand All @@ -438,7 +438,7 @@ const submit = async () => {
})
.catch((error) => {
toast.add({ severity: 'error', summary: 'Error', detail: error.message, life: 3000 });
console.error('Error creating org', error);
console.error('Error creating org:', error);
});
}
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/LEVANTE/RegisterUsers.vue
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ async function submitUsers() {
toast.add({
severity: 'error',
summary: 'User Creation Failure: ' + error.message,
summary: 'Error registering users: ' + error.message,
life: 9000,
});
Expand Down

0 comments on commit 385d3ea

Please sign in to comment.