Skip to content

Commit

Permalink
Use json data
Browse files Browse the repository at this point in the history
  • Loading branch information
gueldenstone committed May 9, 2024
1 parent deea266 commit 1786c46
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/api/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::AppState;
use actix_web::{error, get, post, web::Data, web::Form, web::Json};
use actix_web::{error, get, post, web::Data, web::Json};
use serde::Deserialize;
use spaceapi::{State, Status};

Expand All @@ -21,15 +21,15 @@ pub async fn get_status(app_state: Data<AppState>) -> Json<Status> {
}

#[derive(Debug, Deserialize)]
struct StateFormData {
struct StateData {
open: Option<bool>,
message: Option<String>,
}

#[post("/status/state")]
pub async fn set_state(
app_state: Data<AppState>,
new_state_data: Form<StateFormData>,
new_state_data: Json<StateData>,
) -> Result<Json<String>, SetStateError> {
let mut status = match app_state.status.lock() {
Err(err) => {
Expand Down

0 comments on commit 1786c46

Please sign in to comment.