Fixed challenge 03

Signed-off-by: TuDatTr <tuan-dat.tran@tudattr.dev>
main
TuDatTr 2024-02-02 03:53:18 +01:00
parent 4c1aff8142
commit f31fb3bcdc
4 changed files with 5 additions and 5 deletions

View File

@ -11,7 +11,7 @@ type AppState = Arc<Mutex<State>>;
#[derive(Default)]
pub struct State {
uid: IdCounter,
message: String,
message: Vec<String>,
}
#[derive(Debug, Default)]

View File

@ -42,7 +42,7 @@ pub enum MessageBody {
ReadOk {
msg_id: u64,
in_reply_to: u64,
message: String,
message: Vec<String>,
},
Default,
}

View File

@ -1,5 +1,5 @@
use axum::{extract::State, http::StatusCode, Json};
use tracing::{info};
use tracing::info;
use crate::{
messages::{Message, MessageBody},
@ -51,7 +51,7 @@ pub async fn challenge(
let in_reply_to = msg_id;
{
let mut local_state = state.lock().unwrap();
local_state.message = message;
local_state.message.push(message);
}
MessageBody::BroadcastOk {
msg_id,

View File

@ -85,7 +85,7 @@ async fn test_rw() {
"type": "read_ok",
"msg_id": 2,
"in_reply_to": 2,
"message": message
"message": vec![message]
}
}
);