Uh oh!
There was an error while loading. Please reload this page.
Added explanation of the fetch module. - #57
Conversation
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| if meta.status.is_success() { | ||
| match data.message { | ||
| "success" => { | ||
| Self::Message::ReceiveLocation(data.clone()) |
There was a problem hiding this comment.
Not sure, I think not.
| if meta.status.is_success() { | ||
| match data.message { | ||
| "success" => { |
There was a problem hiding this comment.
I think we should be more succinct here: if meta.status.is_success() && data.message == "success"
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| fn view(&self) -> Html { | ||
| html! { | ||
| <> | ||
| {if self.fetching { |
There was a problem hiding this comment.
Can you please break out this block and the match self.iss block into their own methods on FetchServiceExample? I'd like the examples to set a good precedent for splitting up view logic
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Justin Starry <justin.m.starry@gmail.com>
Co-authored-by: Justin Starry <justin.m.starry@gmail.com>
Co-authored-by: Justin Starry <justin.m.starry@gmail.com>
Co-authored-by: Justin Starry <justin.m.starry@gmail.com>
Co-authored-by: Justin Starry <justin.m.starry@gmail.com>
| // split up the response into the HTTP data about the request result and data from the request | ||
| let (meta, Json(data)) = response.into_parts(); | ||
| if meta.status.is_success() && data.message == "success" { | ||
| Self::Message::ReceiveLocation(match data { |
There was a problem hiding this comment.
Fixed this (I think).
| ReceiveLocation(location) => { | ||
| self.iss = location; | ||
| self.fetching = false; | ||
| // we want to redraw so that the page no longer says 'fetching...' |
| link: ComponentLink<Self> | ||
| } | ||
| impl FetchServiceExample { |
There was a problem hiding this comment.
nit: can you move this impl block under the impl Component block? It flows better because from top to bottom you see the methods right after seeing
fnview(&self) -> Html{html!{
<>
{self.is_fetching()}{self.view_iss_location()}
</>
}}| // handle errors more properly than this | ||
| Err(_) => panic!("Could not handle this error") |
There was a problem hiding this comment.
Maybe we should handle the error to show a more complete example? Not sure if people get tripped up on error handling or not
There was a problem hiding this comment.
I'll add some error handling.
No description provided.