[] = [
- View details
+ Share Song
diff --git a/components/scoreplaylog/page.tsx b/components/scoreplaylog/page.tsx
index 0ce63a2..3f52c5e 100644
--- a/components/scoreplaylog/page.tsx
+++ b/components/scoreplaylog/page.tsx
@@ -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 (
+
+
Failed to load user data
+
+ );
}
+
+ const songs = await getSongsWithTitles(TypedUser.data.UserId);
+
return (
@@ -22,4 +30,4 @@ const ChunithmData = async () => {
);
};
-export default ChunithmData;
+export default ChunithmScorePlaylog;
diff --git a/package.json b/package.json
index 8fd6284..bb8dd73 100644
--- a/package.json
+++ b/package.json
@@ -85,13 +85,12 @@
"zustand": "^4.5.2"
},
"devDependencies": {
- "typescript": "^5.5.2",
"@types/node": "^20.14.8",
- "@types/react": "^18",
"@types/react-dom": "^18",
+ "eslint": "^8",
+ "eslint-config-next": "14.2.4",
"postcss": "^8",
"tailwindcss": "^3.4.1",
- "eslint": "^8",
- "eslint-config-next": "14.2.4"
+ "typescript": "^5.5.2"
}
}