mirror of
https://github.com/rommapp/romm.git
synced 2026-10-12 02:21:58 +00:00
fix(v2): use correct route name when navigating after delete
Deleting a platform or collection in the v2 UI showed "Failed to
delete: unknown error" even though the deletion succeeded. The success
handler navigated to a non-existent route name ("platforms" /
"collections"), and Vue Router threw on the unknown name, which the
catch block surfaced as a generic error.
Navigate to the real index routes (PLATFORMS_INDEX / COLLECTIONS_INDEX)
instead.
Fixes #3598
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Cv77VUJgPe1H7ipSRitjpH
This commit is contained in:
@@ -18,6 +18,7 @@ import { RDivider, type RTabNavItem } from "@v2/lib";
|
||||
import { computed, nextTick, onMounted, ref, watch } from "vue";
|
||||
import { useI18n } from "vue-i18n";
|
||||
import { onBeforeRouteUpdate, useRoute, useRouter } from "vue-router";
|
||||
import { ROUTES } from "@/plugins/router";
|
||||
import collectionApi from "@/services/api/collection";
|
||||
import storeAuth from "@/stores/auth";
|
||||
import storeCollections, {
|
||||
@@ -267,7 +268,7 @@ async function onDelete() {
|
||||
snackbar.success(`Collection "${c.name}" deleted`, {
|
||||
icon: "mdi-check-bold",
|
||||
});
|
||||
router.push({ name: "collections" });
|
||||
router.push({ name: ROUTES.COLLECTIONS_INDEX });
|
||||
} catch (err) {
|
||||
const e = err as {
|
||||
response?: { data?: { msg?: string; detail?: string } };
|
||||
|
||||
@@ -372,7 +372,7 @@ async function onDelete() {
|
||||
snackbar.success(`Platform "${p.display_name}" deleted`, {
|
||||
icon: "mdi-check-bold",
|
||||
});
|
||||
router.push({ name: "platforms" });
|
||||
router.push({ name: ROUTES.PLATFORMS_INDEX });
|
||||
} catch (err) {
|
||||
const e = err as {
|
||||
response?: { data?: { msg?: string } };
|
||||
|
||||
Reference in New Issue
Block a user