diff --git a/.env.example b/.env.example index 3c65834..bf57cdb 100644 --- a/.env.example +++ b/.env.example @@ -1,2 +1 @@ -NEXT_APP_URL=https://next-dashboard.tzgyn.com DATABASE_URL=postgres://postgres:password@127.0.0.1:5432/next-dashboard diff --git a/app/api/bookmark/route.ts b/app/api/bookmark/route.ts index 7de3850..a614468 100644 --- a/app/api/bookmark/route.ts +++ b/app/api/bookmark/route.ts @@ -2,8 +2,6 @@ import { bookmarkSchema } from '@/types' import { NextRequest, NextResponse } from 'next/server' import { db, bookmark } from '@/lib/schema' -export const dynamic = 'force-dynamic' - export const GET = async () => { const bookmarks = await db.select().from(bookmark) diff --git a/app/dashboard/page.tsx b/app/dashboard/page.tsx index 6f5e1fd..e4cc869 100644 --- a/app/dashboard/page.tsx +++ b/app/dashboard/page.tsx @@ -1,24 +1,19 @@ import { BookmarkCard } from '@/components/bookmarkCard' import { bookmarkSchema } from '@/types' +import { db, bookmark } from '@/lib/schema' -const getData = async () => { - const res = await fetch(process.env.NEXT_APP_URL + '/api/bookmark', { - method: 'GET', - cache: 'no-store', - }) - const data = await res.json() - - return bookmarkSchema.array().parse(data) -} +export const dynamic = 'force-dynamic' +export const fetchCache = 'force-no-store' export default async function DashboardPage() { - const data = await getData() + const data = await db.select().from(bookmark) + const bookmarks = bookmarkSchema.array().parse(data) return (