aboutsummaryrefslogtreecommitdiff
path: root/src/api.rs
diff options
context:
space:
mode:
authorFuwn <[email protected]>2020-11-19 23:53:52 +0000
committerFuwn <[email protected]>2020-11-19 23:53:52 +0000
commit26b647ca3f006662676690e6b99bfbfb32167738 (patch)
tree1815e651090e928341b7f88be6781028a400b19a /src/api.rs
parentfeat: limitations in readme (diff)
downloadchan-26b647ca3f006662676690e6b99bfbfb32167738.tar.xz
chan-26b647ca3f006662676690e6b99bfbfb32167738.zip
feat, chore (desc)
feat: - add example database - ADD BOARDS - 404 page - better ui (bootstrap) chore: - move structures to strucutres file - various capitalizations
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))
}