Merge pull request #49 from R15-Software-Dev/fix/toast-display-error

Show error toasts on failed submissions
This commit was merged in pull request #49.
This commit is contained in:
Lucas Vas authored and GitHub committed 2026-01-14 11:05:08 -05:00
commit 73392d0f42
2 files changed
+24 -12

No files matched your search

+11 -5
View File
@@ -121,18 +121,24 @@ pub fn ProviderContactPage() -> impl IntoView {
let mut toasts_context = expect_context::<ToastContext>();
Effect::new(move || {
submit_action.value().get().is_some()
.then(|| {
toasts_context.toast(
match submit_action.value().get() {
Some(Ok(_)) => toasts_context.toast(
Toast::new()
.id(uuid::Uuid::new_v4())
.header("Submission Successful")
.msg("You can go back or continue editing your responses.")
);
),
Some(Err(err)) => toasts_context.toast(
Toast::new()
.id(uuid::Uuid::new_v4())
.header("Submission Failed")
.msg(err.to_string())
),
_ => {}
}
submit_action.clear();
});
});
// Display contact form.
view! {
+13 -7
View File
@@ -491,18 +491,24 @@ fn ScholarshipForm(
};
Effect::new(move || {
submit_action.value().get().is_some()
.then(|| {
log!("Displaying toasts!");
toasts.toast(
match submit_action.value().get() {
Some(Ok(_)) => toasts.toast(
Toast::new()
.id(uuid::Uuid::new_v4())
.msg("Succesfully submitted.")
);
.header("Submission Successful")
.msg("You can go back or continue editing your responses.")
),
Some(Err(err)) => toasts.toast(
Toast::new()
.id(uuid::Uuid::new_v4())
.header("Submission Failed")
.msg(err.to_string())
),
_ => {}
}
submit_action.clear();
});
});
//#endregion