From 212a87126dfbbb6b05b587ec2fd1fb15cb95496c Mon Sep 17 00:00:00 2001 From: Spythere Date: Fri, 6 Feb 2026 17:05:21 +0100 Subject: [PATCH] chore(profile): changed routing from params to query --- src/router/index.ts | 2 +- src/views/PlayerProfileView.vue | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/router/index.ts b/src/router/index.ts index bf71128..1555974 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -62,7 +62,7 @@ const routes: Array = [ }) }, { - path: '/profile/:id', + path: '/profile', name: 'PlayerProfileView', component: () => import('../views/PlayerProfileView.vue') }, diff --git a/src/views/PlayerProfileView.vue b/src/views/PlayerProfileView.vue index 419bbdd..4458524 100644 --- a/src/views/PlayerProfileView.vue +++ b/src/views/PlayerProfileView.vue @@ -175,6 +175,7 @@ interface JournalEntry { const apiStore = useApiStore(); const route = useRoute(); +const playerId = ref(-1); const playerName = ref(''); const playerInfo = ref(null); const playerJournal = ref(null); @@ -186,6 +187,9 @@ const activeFilterTypes = reactive>({ }); onMounted(() => { + playerId.value = Number(route.query.playerId) || -1; + playerName.value = route.query.playerName?.toString() || ''; + fetchPlayerInfoData(); fetchPlayerJournal(); }); @@ -231,14 +235,12 @@ const combinedJournal = computed(() => { }); async function fetchPlayerInfoData() { - const playerId = route.params.id.toString(); - - if (!apiStore.client || !playerId) return; + if (!apiStore.client || !playerId.value) return; try { const response = await apiStore.client.get('api/getPlayerInfo', { params: { - playerId: playerId + playerId: playerId.value } }); @@ -249,14 +251,12 @@ async function fetchPlayerInfoData() { } async function fetchPlayerJournal() { - const playerId = route.params.id.toString(); - - if (!apiStore.client || !playerId) return; + if (!apiStore.client || !playerId.value) return; try { const response = await apiStore.client.get('api/getPlayerJournal', { params: { - playerId: playerId, + playerId: playerId.value, countLimit: 15 } });