daphnis/components/scoreplaylog/page.tsx
2024-07-23 16:15:27 -04:00

30 lines
712 B
TypeScript

import { DataTable } from "./data-table";
import { getAuth } from "@/auth/queries/getauth";
import { z } from "zod";
import { columns } from "./colums";
import { getSongsWithTitles } from "@/app/(sharing)/[token]/[id]/actions";
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;