mirror of
https://github.com/Drop-OSS/drop.git
synced 2025-11-14 00:31:25 +10:00
fix: return user library for client
This commit is contained in:
@ -1,8 +1,9 @@
|
||||
import { defineClientEventHandler } from "~/server/internal/clients/event-handler";
|
||||
import prisma from "~/server/internal/db/database";
|
||||
import userLibraryManager from "~/server/internal/userlibrary";
|
||||
|
||||
export default defineClientEventHandler(async (h3) => {
|
||||
// TODO return the user's library
|
||||
const games = await prisma.game.findMany({});
|
||||
return games;
|
||||
});
|
||||
export default defineClientEventHandler(async (h3, { fetchUser }) => {
|
||||
const user = await fetchUser();
|
||||
const library = await userLibraryManager.fetchLibrary(user.id);
|
||||
return library.entries.map((e) => e.game);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user