This commit is contained in:
Franklin 2023-04-25 06:23:24 -04:00
parent b136071e8c
commit a4255eb4fd
3 changed files with 10 additions and 4 deletions

View File

@ -184,6 +184,7 @@ pub async fn create_new_project(project: NewProjectPayload) -> Result<Project, e
)
.await
}
pub async fn create_location(location: NewLocationPayload) -> Result<Location, err::Error> {
perform_request_without_client(
BASE_URL.into(),
@ -196,6 +197,7 @@ pub async fn create_location(location: NewLocationPayload) -> Result<Location, e
)
.await
}
pub async fn update_project(project: UpdateProjectPayload) -> Result<Project, err::Error> {
perform_request_without_client(
BASE_URL.into(),
@ -234,6 +236,7 @@ pub async fn delete_agent(agent_id: &Uuid) -> Result<(), err::Error> {
)
.await
}
pub async fn delete_unit(unit_id: &Uuid) -> Result<(), err::Error> {
perform_request_without_client::<String, ()>(
BASE_URL.into(),

View File

@ -3,8 +3,9 @@ use yew::prelude::*;
use yew_router::prelude::use_navigator;
use crate::{
api::backend::delete_project,
pages::admin::edit::{EditItem, EditType},
routes::main_router::Route, api::backend::delete_project,
routes::main_router::Route,
};
#[function_component(AdminProject)]
@ -24,8 +25,10 @@ pub fn admin_project(props: &AdminProjectProps) -> Html {
let index = index.clone();
wasm_bindgen_futures::spawn_local(async move {
match delete_project(&project_id).await {
Ok(_) => {force_update_handle.emit(index)},
Err(error) => {log::error!("Error deleting project: {error}")}
Ok(_) => force_update_handle.emit(index),
Err(error) => {
log::error!("Error deleting project: {error}")
}
};
});
is_attempting_delete.set(false);

View File

@ -24,7 +24,7 @@ pub fn admin_projects() -> Html {
};
});
});
html! {
<>
<AdminNavigationBar/>