shares now open in a new tab
This commit is contained in:
@ -1,20 +1,28 @@
|
||||
import { DataTable } from "./data-table";
|
||||
import { getSongsWithTitles } from "@/lib/api";
|
||||
import { Song, columns } from "./colums";
|
||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
||||
import { getAuth } from "@/auth/queries/getauth";
|
||||
import { z } from "zod";
|
||||
import { columns } from "./colums";
|
||||
|
||||
const ChunithmData = async () => {
|
||||
const userSchema = z.object({
|
||||
UserId: z.number()
|
||||
});
|
||||
|
||||
const ChunithmScorePlaylog = async () => {
|
||||
const { user } = await getAuth();
|
||||
let songs: Song[] = [];
|
||||
|
||||
if (user?.UserId !== undefined) {
|
||||
songs = await getSongsWithTitles(user.UserId);
|
||||
} else {
|
||||
return {
|
||||
error: "no user id ",
|
||||
};
|
||||
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 (
|
||||
<div className="p-10">
|
||||
<DataTable columns={columns} data={songs} />
|
||||
@ -22,4 +30,4 @@ const ChunithmData = async () => {
|
||||
);
|
||||
};
|
||||
|
||||
export default ChunithmData;
|
||||
export default ChunithmScorePlaylog;
|
||||
|
Reference in New Issue
Block a user