diff --git a/app/RefreshButton.tsx b/app/RefreshButton.tsx
new file mode 100644
index 0000000..dd92857
--- /dev/null
+++ b/app/RefreshButton.tsx
@@ -0,0 +1,21 @@
+'use client'
+
+import { useTransition } from 'react'
+import { refreshFeed } from './actions'
+
+export default function RefreshButton() {
+ const [pending, startTransition] = useTransition()
+
+ return (
+
+
+
+ )
+}
diff --git a/app/actions.ts b/app/actions.ts
index ccea8b7..78b3d0d 100644
--- a/app/actions.ts
+++ b/app/actions.ts
@@ -1,7 +1,7 @@
"use server";
import { redirect } from "next/navigation";
-import { revalidatePath } from "next/cache";
+import { revalidatePath, refresh } from "next/cache";
import { query } from "@/lib/db";
import {
createSession,
@@ -70,6 +70,10 @@ export async function logout() {
redirect("/login");
}
+export async function refreshFeed(): Promise {
+ refresh();
+}
+
export async function createPost(formData: FormData): Promise {
const user = await getCurrentUser();
if (!user) redirect("/login");
diff --git a/app/page.tsx b/app/page.tsx
index 65e8e04..c514022 100644
--- a/app/page.tsx
+++ b/app/page.tsx
@@ -3,6 +3,7 @@ import { getCurrentUser } from "@/lib/auth";
import { query } from "@/lib/db";
import Composer from "./Composer";
import LogoutButton from "./LogoutButton";
+import RefreshButton from "./RefreshButton";
type FeedPost = {
id: number;
@@ -80,6 +81,8 @@ export default async function Home() {
)}
+
+
{posts.length === 0 ? (
diff --git a/next.config.ts b/next.config.ts
index ebda4e0..a49db1e 100644
--- a/next.config.ts
+++ b/next.config.ts
@@ -1,6 +1,7 @@
import type { NextConfig } from "next";
const nextConfig: NextConfig = {
+ allowedDevOrigins: ["*.trycloudflare.com"],
experimental: {
serverActions: {
// Allow image uploads up to ~5MB through Server Actions.