Skip to content

Commit

Permalink
webpage: stats: stats_frequency: Use json function over serde_json
Browse files Browse the repository at this point in the history
Signed-off-by: Patrick José Pereira <[email protected]>
  • Loading branch information
patrickelectric authored and joaoantoniocardoso committed Nov 8, 2024
1 parent 6051127 commit f5eb925
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/webpage/src/stats/stats_frequency.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,8 @@ pub fn set_stats_frequency(stats_frequency: &Arc<Mutex<f32>>, new_stats_frequenc
request,
move |result: ehttp::Result<ehttp::Response>| 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:?}"),
Expand Down

0 comments on commit f5eb925

Please sign in to comment.