From c01b8b8c90fa762f25bf52437611643e3ca16e5a Mon Sep 17 00:00:00 2001 From: Tyler Murphy Date: Sat, 28 Jan 2023 02:51:34 -0500 Subject: fix rerendering logout button, console page --- src/types/post.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/types/post.rs') diff --git a/src/types/post.rs b/src/types/post.rs index 94f0a9e..7805a4e 100644 --- a/src/types/post.rs +++ b/src/types/post.rs @@ -18,7 +18,7 @@ impl Post { pub fn from_post_id(post_id: u64) -> Result { let Ok(Some(post)) = database::posts::get_post(post_id) else { - return Err(ResponseCode::BadRequest.msg("Post does not exist")) + return Err(ResponseCode::BadRequest.text("Post does not exist")) }; Ok(post) @@ -35,21 +35,21 @@ impl Post { pub fn from_post_page(page: u64) -> Result> { let Ok(posts) = database::posts::get_post_page(page) else { - return Err(ResponseCode::BadRequest.msg("Failed to fetch posts")) + return Err(ResponseCode::BadRequest.text("Failed to fetch posts")) }; Ok(posts) } pub fn from_user_id(user_id: u64) -> Result> { let Ok(posts) = database::posts::get_users_posts(user_id) else { - return Err(ResponseCode::BadRequest.msg("Failed to fetch posts")) + return Err(ResponseCode::BadRequest.text("Failed to fetch posts")) }; Ok(posts) } pub fn new(user_id: u64, content: String) -> Result { let Ok(post) = database::posts::add_post(user_id, &content) else { - return Err(ResponseCode::InternalServerError.msg("Failed to create post")) + return Err(ResponseCode::InternalServerError.text("Failed to create post")) }; Ok(post) @@ -59,7 +59,7 @@ impl Post { self.comments.push((user_id, content)); if database::posts::update_post(self.post_id, &self.likes, &self.comments).is_err() { - return Err(ResponseCode::InternalServerError.msg("Failed to comment on post")) + return Err(ResponseCode::InternalServerError.text("Failed to comment on post")) } Ok(()) @@ -74,7 +74,7 @@ impl Post { } if database::posts::update_post(self.post_id, &self.likes, &self.comments).is_err() { - return Err(ResponseCode::InternalServerError.msg("Failed to comment on post")) + return Err(ResponseCode::InternalServerError.text("Failed to comment on post")) } Ok(()) -- cgit v1.2.3-freya