diff --git a/src/pages/scholarship_info.rs b/src/pages/scholarship_info.rs
index 1b5845d..43a203d 100644
--- a/src/pages/scholarship_info.rs
+++ b/src/pages/scholarship_info.rs
@@ -259,7 +259,7 @@ fn ScholarshipForm(
});
let comparison_list: Resource> = Resource::new(
- move || (), // There's no input to this function.
+ move || scholarship_id.get(), // There's no input to this function.
async move |_| {
get_comparison_info().await
.unwrap_or_else(|e| {
@@ -269,10 +269,14 @@ fn ScholarshipForm(
}
);
- let scholarship_info: Resource> = Resource::new(
- move || scholarship_id.get().unwrap_or_default(),
- async move |id| {
- get_scholarship_info(id).await
+ let scholarship_info = Resource::new(
+ move || scholarship_id.get(),
+ async move |opt_id| {
+ if let Some(id) = opt_id {
+ get_scholarship_info(id).await
+ } else {
+ Err(ServerFnError::new("Cannot get from server with no ID."))
+ }
}
);
@@ -296,139 +300,144 @@ fn ScholarshipForm(
view! {
-
- {move || {
- scholarship_info.get()
- .map(|res_scholarship| {
- match res_scholarship {
- Ok(scholarship) => {
- let reactive_info = scholarship.as_reactive();
-
- Either::Left(view! {
-
-
- "Scholarship Info Form (test)"
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- "Submit"
-
-
- {result_msg}
-
- })
+ "Choose a scholarship from the right, or create a new one."
}
+ >
+
+ {move || {
+ scholarship_info.get()
+ .map(|res_scholarship| {
+ match res_scholarship {
+ Ok(scholarship) => {
+ let reactive_info = scholarship.as_reactive();
+
+ Either::Left(view! {
+
+
+ "Scholarship Info Form (test)"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ "Submit"
+
+
+ {result_msg}
+
+ })
+ }
+ Err(err) => {
+ Either::Right(view! {
+ "Error while getting scholarship: "{err.to_string()}
+ })
+ }
}
- Err(err) => {
- Either::Right(view! {
- "Error while getting scholarship: "{err.to_string()}
- })
- }
- }
- }).collect_view()
- }}
-
+ }).collect_view()
+ }}
+
+
}
}