Show error toasts on failed submissions #49
No files matched your search
@@ -121,17 +121,23 @@ pub fn ProviderContactPage() -> impl IntoView {
|
|||||||
|
|
||||||
let mut toasts_context = expect_context::<ToastContext>();
|
let mut toasts_context = expect_context::<ToastContext>();
|
||||||
Effect::new(move || {
|
Effect::new(move || {
|
||||||
submit_action.value().get().is_some()
|
match submit_action.value().get() {
|
||||||
.then(|| {
|
Some(Ok(_)) => toasts_context.toast(
|
||||||
toasts_context.toast(
|
Toast::new()
|
||||||
Toast::new()
|
.id(uuid::Uuid::new_v4())
|
||||||
.id(uuid::Uuid::new_v4())
|
.header("Submission Successful")
|
||||||
.header("Submission Successful")
|
.msg("You can go back or continue editing your responses.")
|
||||||
.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();
|
submit_action.clear();
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Display contact form.
|
// Display contact form.
|
||||||
|
|||||||
@@ -483,17 +483,23 @@ fn ScholarshipForm(
|
|||||||
};
|
};
|
||||||
|
|
||||||
Effect::new(move || {
|
Effect::new(move || {
|
||||||
submit_action.value().get().is_some()
|
match submit_action.value().get() {
|
||||||
.then(|| {
|
Some(Ok(_)) => toasts.toast(
|
||||||
log!("Displaying toasts!");
|
Toast::new()
|
||||||
toasts.toast(
|
.id(uuid::Uuid::new_v4())
|
||||||
Toast::new()
|
.header("Submission Successful")
|
||||||
.id(uuid::Uuid::new_v4())
|
.msg("You can go back or continue editing your responses.")
|
||||||
.msg("Succesfully submitted.")
|
),
|
||||||
);
|
Some(Err(err)) => toasts.toast(
|
||||||
|
Toast::new()
|
||||||
|
.id(uuid::Uuid::new_v4())
|
||||||
|
.header("Submission Failed")
|
||||||
|
.msg(err.to_string())
|
||||||
|
),
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
|
|
||||||
submit_action.clear();
|
submit_action.clear();
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
let create_comps = ServerAction::<CreateTestComparisons>::new();
|
let create_comps = ServerAction::<CreateTestComparisons>::new();
|
||||||
|
|||||||
Reference in new issue
Block a user