daphnis/components/scoreplaylog/page.tsx
2024-07-01 14:45:16 -04:00

30 lines
685 B
TypeScript

import { DataTable } from "./data-table";
import { getSongsWithTitles } from "@/lib/api";
import { getAuth } from "@/auth/queries/getauth";
import { z } from "zod";
import { columns } from "./colums";
const userSchema = z.object({
UserId: z.number(),
});
const ChunithmScorePlaylog = async () => {
const { user } = await getAuth();
const TypedUser = userSchema.safeParse(user);
if (!TypedUser.success) {
return (
<div className="p-10">
<p>Failed to load user data</p>
</div>
);
}
const songs = await getSongsWithTitles(TypedUser.data.UserId);
return <DataTable columns={columns} data={songs} />;
};
export default ChunithmScorePlaylog;