diff options
Diffstat (limited to 'src/api.rs')
| -rw-r--r-- | src/api.rs | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -2,12 +2,14 @@ use rocket::request::Form; use rocket::response::Redirect; use crate::db::*; +use crate::structures::*; // POST: Create a new thread. #[post("/post", data = "<thread>")] pub fn post(thread: Form<Thread>) -> Redirect { // Pretty rudimentary error handling. match new_thread(Thread { + board: thread.board.clone(), name: thread.name.clone(), comment: thread.comment.clone(), }) { @@ -16,5 +18,5 @@ pub fn post(thread: Form<Thread>) -> Redirect { } // Redirect to all posts. - Redirect::to("/threads") + Redirect::to(format!("/board/{}", thread.board)) } |