matches and transactions history fully operational

This commit is contained in:
Edd
2025-12-31 00:16:14 +00:00
parent 881a60a388
commit 1b03558f93
4 changed files with 264 additions and 146 deletions
+17 -4
View File
@@ -80,22 +80,35 @@ export const useAPIStore = defineStore('api', () => {
const queryParams = new URLSearchParams({
page: params.page || 1,
...(params.type && { type: params.type }),
...(params.outcome && { outcome: params.outcome }),
...(params.status && { status: params.status }),
sort_by: params.sort || 'began_at',
sort_direction: params.direction || 'desc',
...(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()
console.log(params, queryParams)
return axios.get(`${API_BASE_URL}/users/${authStore.currentUserID}/matches?${queryParams}`)
}
const getCurrentUserTransactions = (params = {}) => {
const queryParams = new URLSearchParams({
page: params.page || 1,
...(params.type && { type: params.type }),
...(params.date_from && { date_from: params.date_from }),
...(params.date_to && { date_to: params.date_to }),
}).toString()
return axios.get(`${API_BASE_URL}/users/${authStore.currentUserID}/transactions?${queryParams}`)
}
return {
postLogin,
postLogout,
getAuthUser,
getGames,
getCurrentUserMatches,
getCurrentUserTransactions,
gameQueryParameters,
}
})