I had a warp moment

This commit is contained in:
famfo 2022-04-16 23:58:45 +02:00
parent 08a1803219
commit 4b1f336856
2 changed files with 3 additions and 4 deletions

View file

@ -143,8 +143,7 @@ impl App {
warp::reply::html(tera.render("task/task_page.html", &ctx).unwrap()) warp::reply::html(tera.render("task/task_page.html", &ctx).unwrap())
} }
})) }))
.or(warp::path("task") .or(warp::path("create")
.and(warp::path("create"))
.map({ .map({
let tera = self.tera.clone(); let tera = self.tera.clone();
move || { move || {
@ -202,7 +201,7 @@ pub async fn post_task_sort(form: task::Request, db: Arc<Database>) -> impl warp
pub async fn post_task_create(form: task::Create, db: Arc<Database>)-> impl warp::Reply { pub async fn post_task_create(form: task::Create, db: Arc<Database>)-> impl warp::Reply {
let date = SystemTime::now().duration_since(SystemTime::UNIX_EPOCH).unwrap(); let date = SystemTime::now().duration_since(SystemTime::UNIX_EPOCH).unwrap();
tracing::debug!("Got POST on /api/task/create: {:?}, date: {:?}", form, date); tracing::debug!("Got POST on /api/task/create: {:?}, date: {:?}", form, date);
db.create_task(form); db.create_task(form).await;
warp::redirect(warp::http::Uri::from_static("/task")) warp::redirect(warp::http::Uri::from_static("/task"))
} }

View file

@ -4,7 +4,7 @@
{% include "navbar.html" %} {% include "navbar.html" %}
<a href="api/task/create">Create issue</a><br><br> <a href="/create">Create issue</a><br><br>
<form action="/api/task/sort" method="post"> <form action="/api/task/sort" method="post">
<label for="request">Task group</label> <label for="request">Task group</label>