diff --git a/src/watches/handlers.rs b/src/watches/handlers.rs index 67e55f5..245b761 100644 --- a/src/watches/handlers.rs +++ b/src/watches/handlers.rs @@ -1,5 +1,3 @@ -use std::path::Path; - use axum::{ extract::{Form, Query, State}, http::StatusCode, @@ -9,6 +7,7 @@ use serde::Deserialize; use sqlx::{query_as, SqlitePool}; use uuid::Uuid; +use super::templates::GetSearchWatches; use crate::{AuthContext, GetWatches, ShowKind, User, Watch}; //-************************************************************************ @@ -79,15 +78,21 @@ pub async fn get_watches(auth: AuthContext, State(pool): State) -> i } pub async fn get_search_watch( - _auth: AuthContext, - State(pool): State, + auth: AuthContext, + State(_pool): State, search: Option>, -) { +) -> impl IntoResponse { let search = match search { Some(Query(SimpleSearchQuery { search })) => search, None => "".to_owned(), }; - let search = search.trim(); + let search = search.trim().to_string(); + let user = auth.current_user; + GetSearchWatches { + watches: vec![], + user, + search, + } } pub async fn post_search_watch() {} diff --git a/src/watches/templates.rs b/src/watches/templates.rs index 4a8d6c6..b60e0d3 100644 --- a/src/watches/templates.rs +++ b/src/watches/templates.rs @@ -12,4 +12,8 @@ pub struct GetWatches { #[derive(Debug, Default, Template, Deserialize, Serialize, PartialEq, Eq, OptionalOptionalUser)] #[template(path = "get_search_watches.html")] -pub struct GetSearchWatches {} +pub struct GetSearchWatches { + pub watches: Vec, + pub user: Option, + pub search: String, +} diff --git a/templates/get_search_watches.html b/templates/get_search_watches.html index e69de29..6835865 100644 --- a/templates/get_search_watches.html +++ b/templates/get_search_watches.html @@ -0,0 +1,27 @@ +{% extends "base.html" %} +{% import "macros.html" as m %} + +{% block title %}Welcome to Witch Watch, Bish{% endblock %} + +{% block content %} + +

Whatcha Watchin?

+ +
{{self.search}}
+ +
+
    + {% for watch in watches %} +
  • {{watch.title}} -- {% call m::get_or_default(watch.release_date, "when??") %}:
  • + {% endfor %} +
+
+

+

+ +
+ +
+

+ +{% endblock %}