Merge branch 'develop' into na/matches-home-page

This commit is contained in:
Edd
2026-01-03 00:43:07 +00:00
7 changed files with 2136 additions and 1048 deletions
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+34 -1
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,
@@ -157,19 +174,34 @@ export const useAPIStore = defineStore('api', () => {
...(params.sort_direction == 'asc' && { sort_direction: 'asc' }),
...(params.type && { type: params.type }),
}).toString()
return axios.get(`${API_BASE_URL}/games?${queryParams}`)
}
const getAdminMatches = (params = {}) => {
const queryParams = new URLSearchParams({
page: params.page || 1,
...(params.type && { type: params.type }),
...(params.outcome && { outcome: params.outcome }),
...(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}/matches?${queryParams}`)
}
const postAdmin = async (credentials) => {
return axios.post(`${API_BASE_URL}/admin/users`, credentials)
}
return {
postLogin,
postLogout,
getAuthUser,
getGames,
getCurrentUserGames,
getCurrentUserMatches,
getCurrentUserTransactions,
getCurrentUserStats,
@@ -182,6 +214,7 @@ export const useAPIStore = defineStore('api', () => {
deleteUser,
getAdminTransactions,
getAdminGames,
getAdminMatches,
postAdmin,
gameQueryParameters,
}