create-gufran-expo-app 2.0.4 → 2.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/template/src/navigation/AuthStack.tsx +6 -25
- package/template/src/navigation/MainStack.tsx +0 -148
- package/template/src/navigation/RootNavigator.tsx +4 -26
- package/template/src/navigation/index.ts +0 -1
- package/template/src/navigation/navigationRef.ts +1 -1
- package/template/src/screens/HomeScreen.tsx +3 -215
- package/template/src/screens/auth/LoginScreen.tsx +13 -13
- package/template/src/screens/auth/index.ts +1 -6
- package/template/src/screens/index.ts +0 -35
- package/template/src/services/api.ts +5 -5
- package/template/src/services/authService.ts +3 -299
- package/template/src/services/mainServices.ts +19 -1914
- package/template/src/types/navigation.ts +5 -155
- package/template/src/utils/index.ts +5 -8
- package/template/src/navigation/MiddleStack.tsx +0 -35
- package/template/src/screens/auth/AddMamber.tsx +0 -428
- package/template/src/screens/auth/ForgotPasswordScreen.tsx +0 -176
- package/template/src/screens/auth/OTPVerifyScreen.tsx +0 -359
- package/template/src/screens/auth/RegisterScreen.tsx +0 -430
- package/template/src/screens/auth/SuccessScreen.tsx +0 -201
- package/template/src/screens/chat/ChatScreen.tsx +0 -1819
- package/template/src/screens/chat/ChatThreadsScreen.tsx +0 -360
- package/template/src/screens/chat/ReportMessageScreen.tsx +0 -238
- package/template/src/screens/clubs/Announcements.tsx +0 -426
- package/template/src/screens/clubs/BuyRaffleTicketsScreen.tsx +0 -568
- package/template/src/screens/clubs/ClubDeteils.tsx +0 -497
- package/template/src/screens/clubs/JoinClub.tsx +0 -841
- package/template/src/screens/events/EventScreen.tsx +0 -460
- package/template/src/screens/raffles/MyReferralMembersScreen.tsx +0 -758
- package/template/src/screens/raffles/RaffleDetailsScreen.tsx +0 -762
- package/template/src/screens/raffles/RafflesScreen.tsx +0 -495
- package/template/src/screens/raffles/SetRaffleReminderScreen.tsx +0 -390
- package/template/src/screens/teams/JoinTeamScreen.tsx +0 -464
- package/template/src/screens/teams/MyTeamDetailsScreen.tsx +0 -979
- package/template/src/screens/teams/MyTeamScreen.tsx +0 -568
- package/template/src/screens/teams/PendingRequestsScreen.tsx +0 -426
- package/template/src/screens/volunteerOpportunities/SetReminderScreen.tsx +0 -631
- package/template/src/screens/volunteerOpportunities/VolunteerOpportunitiesDetailsScreen.tsx +0 -1049
- package/template/src/screens/volunteerOpportunities/VolunteerOpportunitiesScreen.tsx +0 -608
- package/template/src/utils/ClubSearchManager.ts +0 -222
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { useMutation, useQuery } from '@tanstack/react-query';
|
|
2
|
-
import { apiClient, API_ENDPOINTS } from '
|
|
3
|
-
import { User } from '../stores/authStore';
|
|
2
|
+
import { apiClient, API_ENDPOINTS } from '@services/api';
|
|
4
3
|
|
|
5
4
|
// Types for API requests and responses
|
|
6
5
|
export interface ApiResponse<T = any> {
|
|
@@ -33,67 +32,6 @@ export interface LoginResponse {
|
|
|
33
32
|
message: string;
|
|
34
33
|
}
|
|
35
34
|
|
|
36
|
-
export interface RegisterRequest {
|
|
37
|
-
email: string;
|
|
38
|
-
password: string;
|
|
39
|
-
profileImage: string;
|
|
40
|
-
name?: string;
|
|
41
|
-
phoneNumber?: string;
|
|
42
|
-
confirmPassword?: string;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export interface RegisterResponse {
|
|
46
|
-
success: boolean;
|
|
47
|
-
message: string;
|
|
48
|
-
data: {
|
|
49
|
-
user: User;
|
|
50
|
-
token: string;
|
|
51
|
-
refreshToken?: string;
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export interface ForgotPasswordRequest {
|
|
56
|
-
email: string;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export interface ForgotPasswordResponse {
|
|
60
|
-
success: boolean;
|
|
61
|
-
message: string;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export interface VerifyOTPRequest {
|
|
65
|
-
email: string;
|
|
66
|
-
otp: string;
|
|
67
|
-
deviceToken: string;
|
|
68
|
-
deviceType: number;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export interface VerifyOTPResponse {
|
|
72
|
-
success: boolean;
|
|
73
|
-
message: string;
|
|
74
|
-
data: {
|
|
75
|
-
userId: number;
|
|
76
|
-
Name: string;
|
|
77
|
-
email: string;
|
|
78
|
-
profileImage: string;
|
|
79
|
-
authorizationToken: string;
|
|
80
|
-
accessToken: string;
|
|
81
|
-
userType: number;
|
|
82
|
-
isProfileCompleted: boolean;
|
|
83
|
-
isAddMember: boolean;
|
|
84
|
-
message: string;
|
|
85
|
-
apiName: string;
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
export interface ResendOTPRequest {
|
|
90
|
-
email: string;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
export interface ResendOTPResponse {
|
|
94
|
-
success: boolean;
|
|
95
|
-
message: string;
|
|
96
|
-
}
|
|
97
35
|
|
|
98
36
|
export interface LogoutResponse {
|
|
99
37
|
success: boolean;
|
|
@@ -101,66 +39,6 @@ export interface LogoutResponse {
|
|
|
101
39
|
apiName?: string;
|
|
102
40
|
}
|
|
103
41
|
|
|
104
|
-
export interface MembersRequest {
|
|
105
|
-
PageNumber: number;
|
|
106
|
-
PageSize: number;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
export interface MembersResponse {
|
|
111
|
-
apiName: string;
|
|
112
|
-
data: {
|
|
113
|
-
members?: any[];
|
|
114
|
-
totalCount: number;
|
|
115
|
-
pageNumber: number;
|
|
116
|
-
pageSize: number;
|
|
117
|
-
totalPages: number;
|
|
118
|
-
};
|
|
119
|
-
message: string;
|
|
120
|
-
success: boolean;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
export interface UpdateMemberRequest {
|
|
124
|
-
id?: number;
|
|
125
|
-
name: string;
|
|
126
|
-
profileImage: string;
|
|
127
|
-
birthDate: string;
|
|
128
|
-
relation: string;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
export interface UpdateMemberResponse {
|
|
132
|
-
apiName: string;
|
|
133
|
-
data: any;
|
|
134
|
-
message: string;
|
|
135
|
-
success: boolean;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
export interface ClubSearchRequest {
|
|
139
|
-
pageNumber: number;
|
|
140
|
-
pageSize: number;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
export interface ClubSearchResponse {
|
|
144
|
-
apiName: string;
|
|
145
|
-
data:any[];
|
|
146
|
-
message: string;
|
|
147
|
-
success: boolean;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
export interface GetImageUrlRequest {
|
|
151
|
-
containerName: string;
|
|
152
|
-
blobName: string;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
export interface GetImageUrlResponse {
|
|
156
|
-
apiName: string;
|
|
157
|
-
data: {
|
|
158
|
-
imageUrl: string;
|
|
159
|
-
url: string;
|
|
160
|
-
};
|
|
161
|
-
message: string;
|
|
162
|
-
success: boolean;
|
|
163
|
-
}
|
|
164
42
|
|
|
165
43
|
// API service functions
|
|
166
44
|
export const authService = {
|
|
@@ -174,45 +52,7 @@ export const authService = {
|
|
|
174
52
|
};
|
|
175
53
|
},
|
|
176
54
|
|
|
177
|
-
register: async (userData: RegisterRequest): Promise<ApiResponse<RegisterResponse>> => {
|
|
178
|
-
const response = await apiClient.post(API_ENDPOINTS.AUTH.REGISTER, userData);
|
|
179
|
-
return {
|
|
180
|
-
data: response.data,
|
|
181
|
-
status: response.status,
|
|
182
|
-
statusText: response.statusText,
|
|
183
|
-
headers: response.headers
|
|
184
|
-
};
|
|
185
|
-
},
|
|
186
55
|
|
|
187
|
-
forgotPassword: async (email: ForgotPasswordRequest): Promise<ApiResponse<ForgotPasswordResponse>> => {
|
|
188
|
-
const response = await apiClient.post(API_ENDPOINTS.AUTH.FORGOT_PASSWORD, email);
|
|
189
|
-
return {
|
|
190
|
-
data: response.data,
|
|
191
|
-
status: response.status,
|
|
192
|
-
statusText: response.statusText,
|
|
193
|
-
headers: response.headers
|
|
194
|
-
};
|
|
195
|
-
},
|
|
196
|
-
|
|
197
|
-
verifyOTP: async (otp: VerifyOTPRequest): Promise<ApiResponse<VerifyOTPResponse>> => {
|
|
198
|
-
const response = await apiClient.post(API_ENDPOINTS.AUTH.VERIFY_OTP, otp);
|
|
199
|
-
return {
|
|
200
|
-
data: response.data,
|
|
201
|
-
status: response.status,
|
|
202
|
-
statusText: response.statusText,
|
|
203
|
-
headers: response.headers
|
|
204
|
-
};
|
|
205
|
-
},
|
|
206
|
-
|
|
207
|
-
resendOTP: async (email: ResendOTPRequest): Promise<ApiResponse<ResendOTPResponse>> => {
|
|
208
|
-
const response = await apiClient.post(API_ENDPOINTS.AUTH.RESEND_OTP, email);
|
|
209
|
-
return {
|
|
210
|
-
data: response.data,
|
|
211
|
-
status: response.status,
|
|
212
|
-
statusText: response.statusText,
|
|
213
|
-
headers: response.headers
|
|
214
|
-
};
|
|
215
|
-
},
|
|
216
56
|
|
|
217
57
|
logout: async (): Promise<ApiResponse<LogoutResponse>> => {
|
|
218
58
|
const response = await apiClient.post(API_ENDPOINTS.AUTH.LOGOUT);
|
|
@@ -224,49 +64,7 @@ export const authService = {
|
|
|
224
64
|
};
|
|
225
65
|
},
|
|
226
66
|
|
|
227
|
-
getMembers: async (params: MembersRequest): Promise<ApiResponse<MembersResponse>> => {
|
|
228
|
-
const response = await apiClient.get(API_ENDPOINTS.USER.MEMBERS, {
|
|
229
|
-
params: params,
|
|
230
|
-
});
|
|
231
|
-
return {
|
|
232
|
-
data: response.data,
|
|
233
|
-
status: response.status,
|
|
234
|
-
statusText: response.statusText,
|
|
235
|
-
headers: response.headers
|
|
236
|
-
};
|
|
237
|
-
},
|
|
238
|
-
|
|
239
|
-
updateMember: async (memberId: number, memberData: UpdateMemberRequest): Promise<ApiResponse<UpdateMemberResponse>> => {
|
|
240
|
-
const response = await apiClient.post(`${API_ENDPOINTS.USER.UPDATE_MEMBER}/${memberId}`, memberData);
|
|
241
|
-
return {
|
|
242
|
-
data: response.data,
|
|
243
|
-
status: response.status,
|
|
244
|
-
statusText: response.statusText,
|
|
245
|
-
headers: response.headers
|
|
246
|
-
};
|
|
247
|
-
},
|
|
248
67
|
|
|
249
|
-
searchClubs: async (params: ClubSearchRequest): Promise<ApiResponse<ClubSearchResponse>> => {
|
|
250
|
-
const response = await apiClient.get(API_ENDPOINTS.CLUB.SEARCH, {
|
|
251
|
-
params: params,
|
|
252
|
-
});
|
|
253
|
-
return {
|
|
254
|
-
data: response.data,
|
|
255
|
-
status: response.status,
|
|
256
|
-
statusText: response.statusText,
|
|
257
|
-
headers: response.headers
|
|
258
|
-
};
|
|
259
|
-
},
|
|
260
|
-
|
|
261
|
-
getImageUrl: async (params: GetImageUrlRequest): Promise<ApiResponse<GetImageUrlResponse>> => {
|
|
262
|
-
const response = await apiClient.post(API_ENDPOINTS.UPLOAD.GET_IMAGE_URL, params);
|
|
263
|
-
return {
|
|
264
|
-
data: response.data,
|
|
265
|
-
status: response.status,
|
|
266
|
-
statusText: response.statusText,
|
|
267
|
-
headers: response.headers
|
|
268
|
-
};
|
|
269
|
-
},
|
|
270
68
|
};
|
|
271
69
|
|
|
272
70
|
// Error handling utility
|
|
@@ -274,7 +72,7 @@ export const getApiErrorInfo = (error: any) => {
|
|
|
274
72
|
const statusCode = error?.response?.status || error?.status || 0;
|
|
275
73
|
const statusText = error?.response?.statusText || error?.statusText || 'Unknown Error';
|
|
276
74
|
const message = error?.response?.data?.message || error?.message || 'An error occurred';
|
|
277
|
-
|
|
75
|
+
|
|
278
76
|
return {
|
|
279
77
|
statusCode,
|
|
280
78
|
statusText,
|
|
@@ -303,64 +101,10 @@ export const useLogin = () => {
|
|
|
303
101
|
});
|
|
304
102
|
};
|
|
305
103
|
|
|
306
|
-
export const useRegister = () => {
|
|
307
|
-
return useMutation({
|
|
308
|
-
mutationFn: authService.register,
|
|
309
|
-
onSuccess: (response) => {
|
|
310
|
-
// Handle successful registration
|
|
311
|
-
console.log('Registration successful:', response.data);
|
|
312
|
-
},
|
|
313
|
-
onError: (error) => {
|
|
314
|
-
// Handle registration error with status code
|
|
315
|
-
const errorInfo = getApiErrorInfo(error);
|
|
316
|
-
console.error('Registration failed:', errorInfo);
|
|
317
|
-
},
|
|
318
|
-
});
|
|
319
|
-
};
|
|
320
104
|
|
|
321
|
-
export const useForgotPassword = () => {
|
|
322
|
-
return useMutation({
|
|
323
|
-
mutationFn: authService.forgotPassword,
|
|
324
|
-
onSuccess: (response) => {
|
|
325
|
-
// Handle successful forgot password request
|
|
326
|
-
console.log('Forgot password request successful:', response.data);
|
|
327
|
-
},
|
|
328
|
-
onError: (error) => {
|
|
329
|
-
// Handle forgot password error with status code
|
|
330
|
-
const errorInfo = getApiErrorInfo(error);
|
|
331
|
-
console.error('Forgot password request failed:', errorInfo);
|
|
332
|
-
},
|
|
333
|
-
});
|
|
334
|
-
};
|
|
335
105
|
|
|
336
|
-
export const useVerifyOTP = () => {
|
|
337
|
-
return useMutation({
|
|
338
|
-
mutationFn: authService.verifyOTP,
|
|
339
|
-
onSuccess: (response) => {
|
|
340
|
-
// Handle successful OTP verification
|
|
341
|
-
console.log('Verify OTP request successful:', response.data);
|
|
342
|
-
},
|
|
343
|
-
onError: (error) => {
|
|
344
|
-
// Handle OTP verification error with status code
|
|
345
|
-
const errorInfo = getApiErrorInfo(error);
|
|
346
|
-
console.error('Verify OTP request failed:', errorInfo);
|
|
347
|
-
},
|
|
348
|
-
});
|
|
349
|
-
};
|
|
350
106
|
|
|
351
|
-
|
|
352
|
-
return useMutation({
|
|
353
|
-
mutationFn: authService.resendOTP,
|
|
354
|
-
onSuccess: (response) => {
|
|
355
|
-
console.log('Resend OTP request successful:', response.data);
|
|
356
|
-
},
|
|
357
|
-
onError: (error) => {
|
|
358
|
-
// Handle resend OTP error with status code
|
|
359
|
-
const errorInfo = getApiErrorInfo(error);
|
|
360
|
-
console.error('Resend OTP request failed:', errorInfo);
|
|
361
|
-
},
|
|
362
|
-
});
|
|
363
|
-
};
|
|
107
|
+
|
|
364
108
|
|
|
365
109
|
export const useLogout = () => {
|
|
366
110
|
return useMutation({
|
|
@@ -376,47 +120,7 @@ export const useLogout = () => {
|
|
|
376
120
|
});
|
|
377
121
|
};
|
|
378
122
|
|
|
379
|
-
export const useMembers = (params: MembersRequest) => {
|
|
380
|
-
return useQuery({
|
|
381
|
-
queryKey: ['members'],
|
|
382
|
-
queryFn: () => authService.getMembers(params),
|
|
383
|
-
});
|
|
384
|
-
};
|
|
385
|
-
|
|
386
|
-
export const useUpdateMember = () => {
|
|
387
|
-
return useMutation({
|
|
388
|
-
mutationFn: ({ memberId, memberData }: { memberId: number; memberData: UpdateMemberRequest }) =>
|
|
389
|
-
authService.updateMember(memberId, memberData),
|
|
390
|
-
onSuccess: (response) => {
|
|
391
|
-
console.log('Member update successful:', response.data);
|
|
392
|
-
},
|
|
393
|
-
onError: (error) => {
|
|
394
|
-
// Handle member update error with status code
|
|
395
|
-
const errorInfo = getApiErrorInfo(error);
|
|
396
|
-
console.error('Member update failed:', errorInfo);
|
|
397
|
-
},
|
|
398
|
-
});
|
|
399
|
-
};
|
|
400
123
|
|
|
401
|
-
export const useClubSearch = (params: ClubSearchRequest) => {
|
|
402
|
-
return useQuery({
|
|
403
|
-
queryKey: ['clubSearch', params],
|
|
404
|
-
queryFn: () => authService.searchClubs(params),
|
|
405
|
-
});
|
|
406
|
-
};
|
|
407
|
-
|
|
408
|
-
export const useGetImageUrl = () => {
|
|
409
|
-
return useMutation({
|
|
410
|
-
mutationFn: authService.getImageUrl,
|
|
411
|
-
onSuccess: (response) => {
|
|
412
|
-
console.log('Get image URL successful:', response.data);
|
|
413
|
-
},
|
|
414
|
-
onError: (error) => {
|
|
415
|
-
const errorInfo = getApiErrorInfo(error);
|
|
416
|
-
console.error('Get image URL failed:', errorInfo);
|
|
417
|
-
},
|
|
418
|
-
});
|
|
419
|
-
};
|
|
420
124
|
|
|
421
125
|
|
|
422
126
|
|