Skip to content

Commit

Permalink
chore!: posts query (#222)
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael-Liendo authored Sep 22, 2024
1 parent 598fd8a commit ebb8359
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
6 changes: 3 additions & 3 deletions crates/client/src/modules/post/posts/mod.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
use anyhow::{anyhow, bail, Result};
use graphql_client::reqwest::post_graphql;
use graphql_client::GraphQLQuery;
use pxid::Pxid;

use posts::{PostsPostsEdges, PostsPostsPageInfo, Variables};
use pxid::Pxid;
use serde::Serialize;

use crate::{DateTime, GRAPHQL_PATH};

use super::PostClient;

#[derive(GraphQLQuery)]
#[graphql(
response_derives = "Clone,Debug,Deserialize",
response_derives = "Clone,Debug,Deserialize,Serializable",
schema_path = "schema.json",
query_path = "src/modules/post/posts/Posts.gql"
)]
Expand Down
19 changes: 18 additions & 1 deletion crates/web/src/components/feed/mod.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,28 @@
mod post;

use leptos::{component, view, IntoView};
use leptos::{component, create_resource, view, IntoView};
use townhall_client::Client;

use self::post::Post;

#[component]
pub fn Feed() -> impl IntoView {
let posts = create_resource(
|| (),
|_| async move {
let client = Client::new("http://localhost:8080");

let posts = client
.unwrap()
.post
.posts(None, None, Some(10), None)
.await
.unwrap();

posts
},
);

view! {
<div id="feed">
<ul class="space-y-4">
Expand Down

0 comments on commit ebb8359

Please sign in to comment.