chore(profile): changed routing from params to query

This commit is contained in:
2026-02-06 17:05:21 +01:00
parent 41e50b8207
commit 212a87126d
2 changed files with 9 additions and 9 deletions
+1 -1
View File
@@ -62,7 +62,7 @@ const routes: Array<RouteRecordRaw> = [
}) })
}, },
{ {
path: '/profile/:id', path: '/profile',
name: 'PlayerProfileView', name: 'PlayerProfileView',
component: () => import('../views/PlayerProfileView.vue') component: () => import('../views/PlayerProfileView.vue')
}, },
+8 -8
View File
@@ -175,6 +175,7 @@ interface JournalEntry {
const apiStore = useApiStore(); const apiStore = useApiStore();
const route = useRoute(); const route = useRoute();
const playerId = ref(-1);
const playerName = ref(''); const playerName = ref('');
const playerInfo = ref<API.PlayerInfo.Data | null>(null); const playerInfo = ref<API.PlayerInfo.Data | null>(null);
const playerJournal = ref<API.PlayerJournal.Data | null>(null); const playerJournal = ref<API.PlayerJournal.Data | null>(null);
@@ -186,6 +187,9 @@ const activeFilterTypes = reactive<Record<JournalEntryType, boolean>>({
}); });
onMounted(() => { onMounted(() => {
playerId.value = Number(route.query.playerId) || -1;
playerName.value = route.query.playerName?.toString() || '';
fetchPlayerInfoData(); fetchPlayerInfoData();
fetchPlayerJournal(); fetchPlayerJournal();
}); });
@@ -231,14 +235,12 @@ const combinedJournal = computed<JournalEntry[]>(() => {
}); });
async function fetchPlayerInfoData() { async function fetchPlayerInfoData() {
const playerId = route.params.id.toString(); if (!apiStore.client || !playerId.value) return;
if (!apiStore.client || !playerId) return;
try { try {
const response = await apiStore.client.get<API.PlayerInfo.Data>('api/getPlayerInfo', { const response = await apiStore.client.get<API.PlayerInfo.Data>('api/getPlayerInfo', {
params: { params: {
playerId: playerId playerId: playerId.value
} }
}); });
@@ -249,14 +251,12 @@ async function fetchPlayerInfoData() {
} }
async function fetchPlayerJournal() { async function fetchPlayerJournal() {
const playerId = route.params.id.toString(); if (!apiStore.client || !playerId.value) return;
if (!apiStore.client || !playerId) return;
try { try {
const response = await apiStore.client.get<API.PlayerJournal.Data>('api/getPlayerJournal', { const response = await apiStore.client.get<API.PlayerJournal.Data>('api/getPlayerJournal', {
params: { params: {
playerId: playerId, playerId: playerId.value,
countLimit: 15 countLimit: 15
} }
}); });