From aea9a2766dedd4033f07d0f48628363513d3b804 Mon Sep 17 00:00:00 2001 From: DecDucK Date: Sat, 24 Jan 2026 20:25:08 +1100 Subject: [PATCH] feat: add store nav and fixes --- components/Modal/CreateCollection.vue | 17 ++-------- components/UserHeader/StoreNav.vue | 39 ++++++++++++++++++++++ dev-tools/compose.yml | 6 ++-- layouts/default.vue | 3 +- nuxt.config.ts | 2 +- pages/store/[id]/index.vue | 4 ++- server/api/v1/client/user/webtoken.post.ts | 10 +++++- server/api/v1/collection/index.post.ts | 16 +++++---- 8 files changed, 69 insertions(+), 28 deletions(-) create mode 100644 components/UserHeader/StoreNav.vue diff --git a/components/Modal/CreateCollection.vue b/components/Modal/CreateCollection.vue index 9a8ddc05..32755152 100644 --- a/components/Modal/CreateCollection.vue +++ b/components/Modal/CreateCollection.vue @@ -59,7 +59,6 @@ const emit = defineEmits<{ const open = defineModel({ required: true }); -const { t } = useI18n(); const collectionName = ref(""); const createCollectionLoading = ref(false); const collections = await useCollections(); @@ -74,6 +73,7 @@ async function createCollection() { const response = await $dropFetch("/api/v1/collection", { method: "POST", body: { name: collectionName.value }, + failTitle: "Failed to create collection", }); // Add the game if provided @@ -83,6 +83,7 @@ async function createCollection() { >(`/api/v1/collection/${response.id}/entry`, { method: "POST", body: { id: props.gameId }, + failTitle: "Failed to add game to collection", }); response.entries.push(entry); } @@ -94,20 +95,6 @@ async function createCollection() { open.value = false; emit("created", response.id); - } catch (error) { - console.error("Failed to create collection:", error); - - const err = error as { statusMessage?: string }; - createModal( - ModalType.Notification, - { - title: t("errors.library.collection.create.title"), - description: t("errors.library.collection.create.desc", [ - err?.statusMessage ?? t("errors.unknown"), - ]), - }, - (_, c) => c(), - ); } finally { createCollectionLoading.value = false; } diff --git a/components/UserHeader/StoreNav.vue b/components/UserHeader/StoreNav.vue new file mode 100644 index 00000000..e93e3b82 --- /dev/null +++ b/components/UserHeader/StoreNav.vue @@ -0,0 +1,39 @@ + + diff --git a/dev-tools/compose.yml b/dev-tools/compose.yml index c2d81883..0dbe5ea4 100644 --- a/dev-tools/compose.yml +++ b/dev-tools/compose.yml @@ -1,12 +1,14 @@ services: postgres: image: postgres:14-alpine - user: "1000:1000" ports: - 5432:5432 volumes: - - ../.data/db:/var/lib/postgresql/data + - postgres-data:/var/lib/postgresql/data environment: - POSTGRES_PASSWORD=drop - POSTGRES_USER=drop - POSTGRES_DB=drop + +volumes: + postgres-data: diff --git a/layouts/default.vue b/layouts/default.vue index 5b453632..f344fd47 100644 --- a/layouts/default.vue +++ b/layouts/default.vue @@ -9,8 +9,9 @@ -
+
+
diff --git a/nuxt.config.ts b/nuxt.config.ts index f5c2b7ef..707d8dad 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -250,7 +250,7 @@ export default defineNuxtConfig({ "https://images.pcgamingwiki.com", "https://images.igdb.com", "https://*.steamstatic.com", - ], + ] }, strictTransportSecurity: false, }, diff --git a/pages/store/[id]/index.vue b/pages/store/[id]/index.vue index b21e50a6..d39e184d 100644 --- a/pages/store/[id]/index.vue +++ b/pages/store/[id]/index.vue @@ -39,7 +39,7 @@
{ - const userId = await aclManager.getUserIdACL(h3, ["collections:read"]); + const userId = await aclManager.getUserIdACL(h3, ["collections:new"]); if (!userId) throw createError({ statusCode: 403, }); - const body = await readBody(h3); - - const name = body.name; - if (!name) - throw createError({ statusCode: 400, statusMessage: "Requires name" }); + const body = await readDropValidatedBody(h3, CreateCollection); // Create the collection using the manager - const newCollection = await userLibraryManager.collectionCreate(name, userId); + const newCollection = await userLibraryManager.collectionCreate(body.name, userId); return newCollection; });