Upgrade to Pro — share decks privately, control downloads, hide ads and more …

20240919 型

Sponsored · Your Podcast. Everywhere. Effortlessly. Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
Avatar for saka saka
December 23, 2025
3

20240919 型

Avatar for saka

saka

December 23, 2025

Transcript

  1. ܕ

  2. const books = await db .select({ id: booksTable.id, title: booksTable.title,

    content: booksTable.content, authorId: booksTable.authorId, authorName: authorsTable.name, }) .from(booksTable) .leftJoin(authorsTable, eq(booksTable.authorId, authorsTable.id));
  3. async function fetcher(key: string): Promise<{ books: BookWithAuthor[] }> { const

    res = await client.api.books.$get(); if (!res.ok) { throw new Error("σʔλͷऔಘʹࣦഊ͠·ͨ͠"); } const data = await res.json(); return data; } export default function SwrPage() { const { data, error, isLoading } = useSWR("/api/books", fetcher); if (error) return <div>Τϥʔ͕ൃੜ͠·ͨ͠</div>; if (isLoading) return <div>ಡΈࠐΈத...</div>;