checkpoint

This commit is contained in:
Joe Ardent 2023-06-10 11:32:40 -07:00
parent a8356dae58
commit c94890b9f0
4 changed files with 19 additions and 6 deletions

View file

@ -26,10 +26,10 @@ type AuthContext =
axum_login::extractors::AuthContext<uuid::Uuid, User, axum_login::SqliteStore<User>>;
/// Returns the router to be used as a service or test object, you do you.
pub async fn app(db_pool: sqlx::SqlitePool, secret: &[u8]) -> axum::Router {
pub async fn app(db_pool: sqlx::SqlitePool, session_secret: &[u8]) -> axum::Router {
use axum::{middleware, routing::get};
let session_layer = db::session_layer(db_pool.clone(), secret).await;
let auth_layer = db::auth_layer(db_pool.clone(), secret).await;
let session_layer = db::session_layer(db_pool.clone(), session_secret).await;
let auth_layer = db::auth_layer(db_pool.clone(), session_secret).await;
// don't bother bringing handlers into the whole crate namespace
use generic_handlers::{handle_slash, handle_slash_redir};

View file

@ -1,5 +1,7 @@
use std::path::Path;
use axum::{
extract::{Form, Path, State},
extract::{Form, Query, State},
http::StatusCode,
response::{IntoResponse, Response},
};
@ -38,9 +40,16 @@ impl IntoResponse for WatchAddError {
}
}
/// Add a Watch to the whole system
//-************************************************************************
// handlers
//-************************************************************************
/// Add a new Watch to the whole system (also adds to your watchlist)
pub async fn put_add_watch() {}
/// Add a Watch to your watchlist
pub async fn post_add_watch() {}
/// A single Watch
pub async fn get_watch() {}

View file

@ -9,3 +9,7 @@ pub struct GetWatches {
pub watches: Vec<Watch>,
pub user: Option<User>,
}
#[derive(Debug, Default, Template, Deserialize, Serialize, PartialEq, Eq)]
#[template(path = "get_search_watches.html")]
pub struct GetSearchWatches {}

View file

@ -22,7 +22,7 @@ Hello, {{ usr.username }}! It's nice to see you.
</ul>
</div>
<p>
<form action="/search" enctype="application/x-www-form-urlencoded" method="post">
<form action="/search" enctype="application/x-www-form-urlencoded" method="get">
<label for="search">Looking for something else to watch?</label>
<input type="text" name="search" id="search"></br>
<input type="submit" value="Let's go!">