Added list for games and matches in the user profile
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -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,
|
||||
}
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user