diff --git a/app/src/login.rs b/app/src/login.rs index 9fa761d..498ab22 100644 --- a/app/src/login.rs +++ b/app/src/login.rs @@ -10,7 +10,8 @@ pub struct LoginForm { on_logged_in: Callback, error: Option, node_ref: NodeRef, - task: Option, + // Used to keep the request alive long enough. + _task: Option, } #[derive(Clone, PartialEq, Properties)] @@ -33,7 +34,7 @@ impl Component for LoginForm { on_logged_in: props.on_logged_in, error: None, node_ref: NodeRef::default(), - task: None, + _task: None, } } @@ -61,7 +62,7 @@ impl Component for LoginForm { req, self.link.callback(Msg::AuthenticationResponse), ) { - Ok(task) => self.task = Some(task), + Ok(task) => self._task = Some(task), Err(e) => self.error = Some(e), } } diff --git a/app/src/user_table.rs b/app/src/user_table.rs index 2d5e1f3..de9097d 100644 --- a/app/src/user_table.rs +++ b/app/src/user_table.rs @@ -7,8 +7,9 @@ use yew::services::{fetch::FetchTask, ConsoleService}; pub struct UserTable { link: ComponentLink, - task: Option, users: Option>>, + // Used to keep the request alive long enough. + _task: Option, } pub enum Msg { @@ -18,9 +19,9 @@ pub enum Msg { impl UserTable { fn get_users(&mut self, req: ListUsersRequest) { match HostService::list_users(req, self.link.callback(Msg::ListUsersResponse)) { - Ok(task) => self.task = Some(task), + Ok(task) => self._task = Some(task), Err(e) => { - self.task = None; + self._task = None; ConsoleService::log(format!("Error trying to fetch users: {}", e).as_str()) } }; @@ -34,7 +35,7 @@ impl Component for UserTable { fn create(_: Self::Properties, link: ComponentLink) -> Self { let mut table = UserTable { link: link.clone(), - task: None, + _task: None, users: None, }; table.get_users(ListUsersRequest { filters: None }); diff --git a/src/infra/tcp_server.rs b/src/infra/tcp_server.rs index 3f19cd8..f84d135 100644 --- a/src/infra/tcp_server.rs +++ b/src/infra/tcp_server.rs @@ -211,7 +211,6 @@ pub fn build_tcp_server( where Backend: BackendHandler + 'static, { - let http_port = config.http_port.clone(); let jwt_secret = config.jwt_secret.clone(); server_builder .bind("http", ("0.0.0.0", config.http_port), move || { @@ -224,5 +223,10 @@ where )) .tcp() }) - .with_context(|| format!("While bringing up the TCP server with port {}", http_port)) + .with_context(|| { + format!( + "While bringing up the TCP server with port {}", + config.http_port + ) + }) }