chore: change form triggers
All checks were successful
/ build-and-push-image (push) Successful in 19s

This commit is contained in:
log101 2024-06-10 07:51:18 +03:00
parent cedbc8af9d
commit 7ebe19f905

View File

@ -8,10 +8,6 @@ import Post from "@/components/Post.astro";
const { entry } = Astro.props; const { entry } = Astro.props;
const host = import.meta.env.PROD
? import.meta.env.SITE
: "http://localhost:8000";
export async function getStaticPaths() { export async function getStaticPaths() {
const blogEntries = await getCollection("blog"); const blogEntries = await getCollection("blog");
return blogEntries.map((entry) => ({ return blogEntries.map((entry) => ({
@ -36,13 +32,19 @@ export async function getStaticPaths() {
<Layout title="log101"> <Layout title="log101">
<Header /> <Header />
<Post post={entry} componentType="full" /> <Post post={entry} componentType="full" />
<div
hx-get=`${host}/blog/api/forms/emoji?postId=${entry.id}`
hx-trigger="load"
hx-swap="innerHTML"
>
</div>
<Footer />
<script></script> <form
hx-post="http://localhost:8000/blog/api/forms/emoji/post"
hx-target="#reaction-buttons"
>
<input type="hidden" name="postId" value=`${entry.id}` />
<div
id="reaction-buttons"
hx-get=`http://localhost:8000/blog/api/forms/emoji?postId=${entry.id}`
hx-trigger="load"
hx-swap="innerHTML"
>
</div>
</form>
<Footer />
</Layout> </Layout>