radars and vehicles

This commit is contained in:
LinlyBoi
2022-12-25 13:10:38 +02:00
parent 298b35af4c
commit f9dfb4bf64
11 changed files with 133 additions and 25 deletions

View File

@@ -114,7 +114,9 @@ impl Component for RandomCommit {
</>
},
FetchState::Fetching => html! { "Fetching" },
FetchState::Success(data) => html! { <p> {data} </p> },
FetchState::Success(data) => {
html! { <> <h2> {"Commit Header:"} </h2> {data}</> }
}
FetchState::Failed(err) => html! { err },
}
}
@@ -177,7 +179,7 @@ impl Component for Driver {
</>
},
FetchState::Fetching => html! { "Fetching" },
FetchState::Success(data) => html! { <p> {data} </p> },
FetchState::Success(data) => html! { <> <h2> {"Driver"} </h2> {data} </> },
FetchState::Failed(err) => html! { err },
}
}
@@ -232,7 +234,8 @@ async fn fetch_driver(url: &'static str) -> Result<String, FetchError> {
let mut opts = RequestInit::new();
opts.method("GET");
opts.mode(RequestMode::Cors); //Cors is required for fetch to work
//initialise request
//initialise request
let request = Request::new_with_str_and_init(url, &opts)?;
let window = gloo::utils::window();
let resp_value = JsFuture::from(window.fetch_with_request(&request)).await?;