Refactoring

This commit is contained in:
Marco De Araujo 2026-01-21 12:34:50 -04:00
parent d8b4843415
commit 17662107b0
2 changed files with 28 additions and 60 deletions

View file

@ -1,9 +1,11 @@
use std::time::Duration;
use anyhow::Result;
use reqwest::blocking::Client;
use crate::{
api::endpoints::UptimeKumaEndpoints,
data::{self, heartbeat::HeartbeatResponse, status_page::model::StatusPageResponse},
data::{self, heartbeat::HeartbeatResponse, status_page::model::StatusPageResponse}, i18n::t,
};
#[derive(Debug, Clone)]
@ -13,8 +15,9 @@ pub struct UptimeKumaClient {
impl UptimeKumaClient {
pub fn new() -> Self {
let client = Client::builder().connect_timeout(Duration::from_secs(10)).timeout(Duration::from_secs(30)).build().unwrap_or_else(|_| panic!("{}", t("http-build-error")));
Self {
client: Client::new(),
client,
}
}