shares now open in a new tab

This commit is contained in:
polaris
2024-06-29 15:25:43 -04:00
parent c784e8808e
commit 4e3938e87e
7 changed files with 40 additions and 27 deletions

View File

@ -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;