From aac328e8ef03f31f3eba49148c21c46fa1c8356b Mon Sep 17 00:00:00 2001 From: yaemiku Date: Sat, 28 Mar 2026 04:27:38 +0100 Subject: [PATCH] update --- app/api/auth/[...all]/route.ts | 4 + app/page.tsx | 262 ++++++++++++---------- lib/auth-client.ts | 8 + lib/auth.ts | 18 ++ lib/websites.ts | 69 ++++++ package.json | 3 + pnpm-lock.yaml | 383 +++++++++++++++++++++++++++++++-- tsconfig.json | 24 ++- 8 files changed, 644 insertions(+), 127 deletions(-) create mode 100644 app/api/auth/[...all]/route.ts create mode 100644 lib/auth-client.ts create mode 100644 lib/auth.ts create mode 100644 lib/websites.ts diff --git a/app/api/auth/[...all]/route.ts b/app/api/auth/[...all]/route.ts new file mode 100644 index 0000000..fcb1ef0 --- /dev/null +++ b/app/api/auth/[...all]/route.ts @@ -0,0 +1,4 @@ +import { auth } from "@/lib/auth"; // path to your auth file +import { toNextJsHandler } from "better-auth/next-js"; + +export const { POST, GET } = toNextJsHandler(auth); diff --git a/app/page.tsx b/app/page.tsx index d9d1f28..44f3d94 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -1,18 +1,20 @@ -'use client'; +"use client"; -import Image from 'next/image'; -import useSWR, { Fetcher } from 'swr'; +import { authClient } from "@/lib/auth-client"; +import websites from "@/lib/websites"; +import Image from "next/image"; +import useSWR, { Fetcher } from "swr"; type LastFM = { - artist: { '#text': string }; - image: [{ size: string; '#text': string }]; + artist: { "#text": string }; + image: [{ size: string; "#text": string }]; mbid: string; album: { mbid: string; - '#text': string; + "#text": string; }; name: string; - '@attr': { nowplaying: string }; + "@attr": { nowplaying: string }; url: string; }; @@ -20,15 +22,17 @@ const fetcher: Fetcher = (...args) => fetch(...args).then((res) => res.json()); export default function Home() { - const { data, isLoading } = useSWR('/api/lastfm', fetcher, { + const { data: session, isPending, error } = authClient.useSession(); + + const { data, isLoading } = useSWR("/api/lastfm", fetcher, { refreshInterval: 5000, }); const jsonLd = { - '@context': 'https://schema.org', - '@type': 'WebSite', - name: 'Nikola Kubiczek', - url: 'https://yaemiku.dev/', + "@context": "https://schema.org", + "@type": "WebSite", + name: "Nikola Kubiczek", + url: "https://yaemiku.dev/", }; return ( @@ -36,12 +40,12 @@ export default function Home() {