From f5eb92585d6048c0be4b5540daa6a4d0a66f8666 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20Jos=C3=A9=20Pereira?= Date: Fri, 8 Nov 2024 16:05:49 -0300 Subject: [PATCH] webpage: stats: stats_frequency: Use json function over serde_json MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Patrick José Pereira --- src/webpage/src/stats/stats_frequency.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/webpage/src/stats/stats_frequency.rs b/src/webpage/src/stats/stats_frequency.rs index 655417e..0d20cea 100644 --- a/src/webpage/src/stats/stats_frequency.rs +++ b/src/webpage/src/stats/stats_frequency.rs @@ -59,10 +59,8 @@ pub fn set_stats_frequency(stats_frequency: &Arc>, new_stats_frequenc request, move |result: ehttp::Result| match result { Ok(response) => { - if let Some(json) = response.text() { - if let Ok(Frequency { frequency }) = serde_json::from_str(json) { - *stats_frequency.lock() = frequency; - } + if let Ok(Frequency { frequency }) = response.json() { + *stats_frequency.lock() = frequency; } } Err(error) => log::error!("Status code: {error:?}"),