From fd752ddf902e4db967535c0b5275c1b16aa9c72e Mon Sep 17 00:00:00 2001 From: Georges-Antoine Assi Date: Fri, 5 Jan 2024 09:01:15 -0500 Subject: [PATCH] small cleanup fixes --- backend/endpoints/platform.py | 2 +- frontend/src/components/Dashboard/Recent.vue | 11 ++++++++--- .../src/components/Dialog/Platform/DeletePlatform.vue | 6 ++++-- frontend/src/components/Gallery/AppBar/AdminMenu.vue | 5 ----- frontend/src/components/Gallery/AppBar/DeleteBtn.vue | 9 +++++---- frontend/src/services/api.ts | 3 ++- frontend/src/types/emitter.d.ts | 2 +- frontend/tsconfig.json | 1 + 8 files changed, 22 insertions(+), 17 deletions(-) diff --git a/backend/endpoints/platform.py b/backend/endpoints/platform.py index 284646981..480b6e86f 100644 --- a/backend/endpoints/platform.py +++ b/backend/endpoints/platform.py @@ -126,7 +126,7 @@ class DeletePlatformResponse(TypedDict): msg: str -@protected_route(router.delete, "/platforms/{fs_slug}", ["roms.write"]) +@protected_route(router.delete, "/platforms/{fs_slug}", ["platforms.write"]) def delete_platform( request: Request, fs_slug: str, delete_from_fs: bool = False ) -> DeletePlatformResponse: diff --git a/frontend/src/components/Dashboard/Recent.vue b/frontend/src/components/Dashboard/Recent.vue index 84d7ef808..f65c43eb0 100644 --- a/frontend/src/components/Dashboard/Recent.vue +++ b/frontend/src/components/Dashboard/Recent.vue @@ -1,7 +1,7 @@ @@ -51,7 +51,12 @@ onMounted(async () => { :lg="views[0]['size-lg']" :xl="views[0]['size-xl']" > - + diff --git a/frontend/src/components/Dialog/Platform/DeletePlatform.vue b/frontend/src/components/Dialog/Platform/DeletePlatform.vue index 25d7e6b2d..7b4c50a7c 100644 --- a/frontend/src/components/Dialog/Platform/DeletePlatform.vue +++ b/frontend/src/components/Dialog/Platform/DeletePlatform.vue @@ -4,11 +4,11 @@ import { useRouter } from "vue-router"; import type { Emitter } from "mitt"; import type { Events } from "@/types/emitter"; import api from "@/services/api"; -import storePlatforms from "@/stores/platforms"; +import storePlatforms, { type Platform } from "@/stores/platforms"; const router = useRouter(); const platformsStore = storePlatforms(); -const platform = ref(); +const platform = ref(null); const show = ref(false); const emitter = inject>("emitter"); emitter?.on("showDeletePlatformDialog", (platformToDelete) => { @@ -18,6 +18,8 @@ emitter?.on("showDeletePlatformDialog", (platformToDelete) => { const deleteFromFs = ref(false); async function deletePlatform() { + if (!platform.value) return; + show.value = false; await api .deletePlatform({ diff --git a/frontend/src/components/Gallery/AppBar/AdminMenu.vue b/frontend/src/components/Gallery/AppBar/AdminMenu.vue index 86765a242..df7847656 100644 --- a/frontend/src/components/Gallery/AppBar/AdminMenu.vue +++ b/frontend/src/components/Gallery/AppBar/AdminMenu.vue @@ -1,12 +1,7 @@