aboutsummaryrefslogtreecommitdiff
path: root/src/api.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/api.rs')
-rw-r--r--src/api.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/api.rs b/src/api.rs
index 8d8d2f2..8fd61c5 100644
--- a/src/api.rs
+++ b/src/api.rs
@@ -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))
}