diff --git a/backend/src/api.rs b/backend/src/api.rs index dda99bc..bf8ccf3 100644 --- a/backend/src/api.rs +++ b/backend/src/api.rs @@ -22,7 +22,7 @@ use validator::{ValidateArgs, ValidationErrors}; #[derive(Serialize, Deserialize, Debug)] struct ApiResponse { - result: Cow<'static, str>, + ok: bool, #[serde(skip_serializing_if = "Option::is_none")] message: Option>, #[serde(skip_serializing_if = "Option::is_none")] @@ -30,18 +30,15 @@ struct ApiResponse { } impl ApiResponse { - const SUCCES_RESULT: Cow<'static, str> = Cow::Borrowed("Ok"); - const FAILURE_RESULT: Cow<'static, str> = Cow::Borrowed("Failure"); - const SUCCES: Self = Self { - result: Self::SUCCES_RESULT, + ok: true, message: None, jwt: None, }; fn login_response(jwt: String) -> Self { Self { - result: Self::SUCCES_RESULT, + ok: true, message: None, jwt: Some(Cow::Owned(jwt)), }