Added list for games and matches in the user profile

This commit is contained in:
2026-01-03 00:06:26 +00:00
parent 030b00059e
commit 1a7916a836
4 changed files with 906 additions and 352 deletions
File diff suppressed because it is too large Load Diff
+19 -2
View File
@@ -76,6 +76,23 @@ export const useAPIStore = defineStore('api', () => {
return axios.get(`${API_BASE_URL}/games?${queryParams}`)
}
// --- ADICIONADO: Função que faltava ---
const getCurrentUserGames = (params = {}) => {
const queryParams = new URLSearchParams({
page: params.page || 1,
...(params.type && { type: params.type }),
...(params.outcome && { outcome: params.outcome }),
...(params.status && { status: params.status }),
...(params.date_from && { date_from: params.date_from }),
...(params.date_to && { date_to: params.date_to }),
sort_by: params.sort_by || 'began_at',
sort_direction: params.sort_direction || 'desc',
}).toString()
return axios.get(`${API_BASE_URL}/users/${authStore.currentUserID}/games?${queryParams}`)
}
// --------------------------------------
const getCurrentUserMatches = (params = {}) => {
const queryParams = new URLSearchParams({
page: params.page || 1,
@@ -164,12 +181,12 @@ export const useAPIStore = defineStore('api', () => {
return axios.post(`${API_BASE_URL}/admin/users`, credentials)
}
return {
postLogin,
postLogout,
getAuthUser,
getGames,
getCurrentUserGames,
getCurrentUserMatches,
getCurrentUserTransactions,
getCurrentUserStats,
@@ -185,4 +202,4 @@ export const useAPIStore = defineStore('api', () => {
postAdmin,
gameQueryParameters,
}
})
})