deduplicated RemoteError
This commit is contained in:
@@ -1,15 +1,6 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
use thiserror::Error;
|
||||
use ts_rs::TS;
|
||||
|
||||
#[derive(Error, Debug)]
|
||||
pub enum RemoteError {
|
||||
#[error("HTTP error: {0}")]
|
||||
Http(#[from] reqwest::Error),
|
||||
#[error("JSON parse error: {0}")]
|
||||
Json(#[from] serde_json::Error),
|
||||
}
|
||||
|
||||
#[derive(Default, Serialize, Deserialize, Clone, Debug, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export)]
|
||||
|
||||
@@ -1,19 +1,8 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
use thiserror::Error;
|
||||
use ts_rs::TS;
|
||||
|
||||
use super::dolls::DollDto;
|
||||
|
||||
#[derive(Error, Debug)]
|
||||
pub enum RemoteError {
|
||||
#[error("HTTP error: {0}")]
|
||||
Http(#[from] reqwest::Error),
|
||||
#[error("JSON parse error: {0}")]
|
||||
Json(#[from] serde_json::Error),
|
||||
#[error("{0}")]
|
||||
Api(String),
|
||||
}
|
||||
|
||||
#[derive(Default, Serialize, Deserialize, Clone, Debug, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export)]
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
pub mod app_data;
|
||||
pub mod remote_error;
|
||||
pub mod dolls;
|
||||
pub mod friends;
|
||||
pub mod health;
|
||||
|
||||
11
src-tauri/src/models/remote_error.rs
Normal file
11
src-tauri/src/models/remote_error.rs
Normal file
@@ -0,0 +1,11 @@
|
||||
use thiserror::Error;
|
||||
|
||||
#[derive(Error, Debug)]
|
||||
pub enum RemoteError {
|
||||
#[error("HTTP error: {0}")]
|
||||
Http(#[from] reqwest::Error),
|
||||
#[error("JSON parse error: {0}")]
|
||||
Json(#[from] serde_json::Error),
|
||||
#[error("{0}")]
|
||||
Api(String),
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
use reqwest::Client;
|
||||
|
||||
use crate::{lock_r, services::auth::with_auth, state::FDOLL, models::dolls::*};
|
||||
use crate::models::remote_error::RemoteError;
|
||||
|
||||
pub struct DollsRemote {
|
||||
pub base_url: String,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
use reqwest::Client;
|
||||
|
||||
use crate::{lock_r, services::auth::with_auth, state::FDOLL, models::friends::*};
|
||||
use crate::models::remote_error::RemoteError;
|
||||
|
||||
pub struct FriendRemote {
|
||||
pub base_url: String,
|
||||
|
||||
Reference in New Issue
Block a user