Implement provider scholarship edit form #33
@@ -259,7 +259,7 @@ fn ScholarshipForm(
|
||||
});
|
||||
|
||||
let comparison_list: Resource<Vec<ComparisonData>> = 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<Result<ExpandableInfo, ServerFnError>> = Resource::new(
|
||||
move || scholarship_id.get().unwrap_or_default(),
|
||||
async move |id| {
|
||||
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,6 +300,10 @@ fn ScholarshipForm(
|
||||
|
||||
view! {
|
||||
<Panel>
|
||||
<Show
|
||||
when=move || scholarship_id.get().is_some()
|
||||
fallback=|| view! { <p>"Choose a scholarship from the right, or create a new one."</p> }
|
||||
>
|
||||
<Suspense fallback=Loading>
|
||||
{move || {
|
||||
scholarship_info.get()
|
||||
@@ -429,6 +437,7 @@ fn ScholarshipForm(
|
||||
}).collect_view()
|
||||
}}
|
||||
</Suspense>
|
||||
</Show>
|
||||
</Panel>
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user