mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-03 05:18:11 +00:00
chore(profile): moved fetching history journal to separate component
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
|
||||
<div class="profile-side">
|
||||
<ProfileRecentStats :playerInfo="playerInfo" />
|
||||
<ProfileHistoryList :playerJournal="playerJournal" :playerName="playerName" />
|
||||
<ProfileHistoryList :playerName="playerName" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -49,7 +49,6 @@ const route = useRoute();
|
||||
const playerName = ref('');
|
||||
|
||||
const playerInfo = ref<API.PlayerInfo.Data | null>(null);
|
||||
const playerJournal = ref<API.PlayerJournal.Data | null>(null);
|
||||
const playerTD2Info = ref<Td2API.UsersInfoByName.UserInfo | null>(null);
|
||||
const playerDataStatus = ref(Status.Data.Initialized);
|
||||
|
||||
@@ -93,11 +92,10 @@ async function fetchAllData() {
|
||||
}
|
||||
|
||||
const playerTd2InfoResponse = await fetchPlayerTD2Info(playerName.value);
|
||||
const playerJournalResponse = await fetchPlayerJournal(playerId);
|
||||
|
||||
playerInfo.value = playerInfoResponse;
|
||||
playerTD2Info.value = playerTd2InfoResponse;
|
||||
playerJournal.value = playerJournalResponse;
|
||||
// playerJournal.value = playerJournalResponse;
|
||||
|
||||
playerDataStatus.value = Status.Data.Loaded;
|
||||
}
|
||||
@@ -120,25 +118,6 @@ async function fetchPlayerInfoData(playerId: string) {
|
||||
return null;
|
||||
}
|
||||
|
||||
async function fetchPlayerJournal(playerId: string) {
|
||||
if (!apiStore.client || !playerId) return null;
|
||||
|
||||
try {
|
||||
const response = await apiStore.client.get<API.PlayerJournal.Data>('api/getPlayerJournal', {
|
||||
params: {
|
||||
playerId: playerId,
|
||||
dateScope: '30d'
|
||||
}
|
||||
});
|
||||
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
async function fetchPlayerTD2Info(playerName: string) {
|
||||
if (!apiStore.client || !playerName) return null;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user