radars and vehicles
This commit is contained in:
@@ -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?;
|
||||
|
||||
Reference in New Issue
Block a user