mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-03 05:18:11 +00:00
chore(profile): changed routing from params to query
This commit is contained in:
+1
-1
@@ -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')
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -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
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user