@@ -17,15 +17,16 @@ export interface raceParticipantUserData {
17
17
phone : string ;
18
18
email : string ;
19
19
language : string ;
20
- shirt : string ;
20
+ team ? : string ;
21
21
km : string ;
22
- shirtGender : ShirtGender ;
22
+ adult : Age ;
23
23
agreementStatements : boolean ;
24
- raceID ?: string ;
24
+ raceID ?: Race [ ] ;
25
25
userId ?: string ;
26
26
}
27
27
28
- export type ShirtGender = 'Damska' | 'Męska' | 'Dziecięca' ;
28
+ export type Age = 'Pełnoletni' | 'Niepełnoletni' ;
29
+ export type Race = 'Kapcie' | 'MatkaIDziecko' | 'Bieg1KM' | 'Bieg5KM' | 'Spacer'
29
30
30
31
export interface UserUpdateData {
31
32
name ?: string ;
@@ -74,8 +75,7 @@ const getConfig = () => {
74
75
75
76
export const register = async ( userData : UserData ) => {
76
77
try {
77
- const response = await axios . post ( `${ apiUrl } /users/signup` , userData ) ;
78
- return response ;
78
+ return await axios . post ( `${ apiUrl } /users/signup` , userData ) ;
79
79
} catch ( error ) {
80
80
const err = error as AxiosError ;
81
81
console . error ( 'Error registering user:' , err ) ;
@@ -139,15 +139,14 @@ export const userParticipation = async (
139
139
participantData : raceParticipantUserData
140
140
) => {
141
141
try {
142
- const response = await axios . post (
142
+ return await axios . post (
143
143
`${ apiUrl } /payment/participate` ,
144
144
{
145
145
amount,
146
146
participant : participantData ,
147
147
} ,
148
148
getConfig ( )
149
149
) ;
150
- return response ;
151
150
} catch ( error ) {
152
151
console . error ( 'Error with user participation:' , error ) ;
153
152
throw error ;
@@ -156,11 +155,10 @@ export const userParticipation = async (
156
155
157
156
export const getUserParticipation = async ( ) => {
158
157
try {
159
- const response = await axios . get (
158
+ return await axios . get (
160
159
`${ apiUrl } /users/participant` ,
161
160
getConfig ( )
162
161
) ;
163
- return response ;
164
162
} catch ( error ) {
165
163
console . error ( 'Error getting participant:' , error ) ;
166
164
throw error ;
@@ -198,11 +196,10 @@ export const resetPassword = async (email: string) => {
198
196
199
197
export const registerForDonation = async ( amount : number , email : string ) => {
200
198
try {
201
- const response = await axios . post ( `${ apiUrl } /payment/donation` , {
199
+ return await axios . post ( `${ apiUrl } /payment/donation` , {
202
200
amount,
203
201
email,
204
202
} ) ;
205
- return response ;
206
203
} catch ( error ) {
207
204
console . error ( 'Error with user participation:' , error ) ;
208
205
throw error ;
0 commit comments