-
Couldn't load subscription status.
- Fork 0
Minor fix #85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Minor fix #85
Conversation
-added staff scan qr page
added staff-qr page
- Fixed Staff-qr handling error - Fix error type assertions in staff/event/index.astro - Remove unused imports and variables
…/fdrpkm68-frontend into feat/firstdate/staff-qr
- Added auth functions getAuthToken() and getAuthHeaders() in api.ts - Fixed body stream error when scan qr code - Added handle error when user is not exist and when user scan wrong qr
- fix ButtonFd not send data
- Fixed no events active layout
…/fdrpkm68-frontend into feat/firstdate/staff-qr
* feat: added staff scan qr page -added staff scan qr page * fix: firstdate staff bg * feat: add @yudiel/react-qr-scanner * Feat: added staff-qr page added staff-qr page * chore: fix middleware doesn't work * feat: Implement qr scan with api * fix: staff-qr code - Fixed Staff-qr handling error - Fix error type assertions in staff/event/index.astro - Remove unused imports and variables * fix: qr scan error, body stream err, cannot send cookie to backend err - Added auth functions getAuthToken() and getAuthHeaders() in api.ts - Fixed body stream error when scan qr code - Added handle error when user is not exist and when user scan wrong qr * Fix: alternative form handle error - fix ButtonFd not send data * fix: no event active layout - Fixed no events active layout * fix: qrcode --------- Co-authored-by: neennera <[email protected]> Co-authored-by: Thukdanai Thaothawin <[email protected]> Co-authored-by: Borworntat Dendumrongkul <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request implements several improvements and fixes across the application, including new group management features, code refactoring, and UI updates. The changes primarily focus on group functionality, profile management, and code organization.
Key changes include:
- Added comprehensive group management API functions (join, leave, fetch by invite code)
- Refactored profile components to share common types and avatar mappings
- Updated UI components with dynamic group member counts and improved error handling
Reviewed Changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| src/lib/groupAPI.ts | Added new API functions for group operations (join, leave, fetch by invite code) |
| src/lib/eventAPI.ts | Simplified error condition checking in event status |
| src/components/rpkm/rubpuen/UserProfile.tsx | Refactored to use shared profile types and improved null safety |
| src/components/rpkm/rubpuen/GroupProfile.tsx | Refactored to use shared avatar mapping and profile types |
| src/components/rpkm/data/profile.ts | New shared module for profile types and avatar mappings |
| src/components/rpkm/components/house-picker.astro | Updated import path for house data |
| src/components/rpkm/components/group-picker.astro | Enhanced with dynamic group functionality and error handling |
| src/components/firstdate/Footer.astro | Removed Instagram contact section and improved layout |
| src/components/common/profile/EditProfile.tsx | Fixed prefix values and improved form data handling |
| src/components/common/Footer.astro | Removed Instagram contact section |
| if (!token) { | ||
| return { | ||
| success: false, | ||
| error: "กรุณาเข้าสู่ระบบก่อนลงทะเบียน", |
Copilot
AI
Jul 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error message 'กรุณาเข้าสู่ระบบก่อนลงทะเบียน' (Please log in before registering) is misleading for a function that fetches group data by invite code. It should indicate authentication is required for accessing group information.
| error: "กรุณาเข้าสู่ระบบก่อนลงทะเบียน", | |
| error: "กรุณาเข้าสู่ระบบเพื่อเข้าถึงข้อมูลกลุ่ม", |
| if (!token) { | ||
| return { | ||
| success: false, | ||
| error: "กรุณาเข้าสู่ระบบก่อนลงทะเบียน", |
Copilot
AI
Jul 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error message 'กรุณาเข้าสู่ระบบก่อนลงทะเบียน' is inappropriate for a group joining function. It should specifically mention group joining rather than registration.
| error: "กรุณาเข้าสู่ระบบก่อนลงทะเบียน", | |
| error: "กรุณาเข้าสู่ระบบก่อนเข้าร่วมกลุ่ม", |
| if (!token) { | ||
| return { | ||
| success: false, | ||
| error: "กรุณาเข้าสู่ระบบก่อนลงทะเบียน", |
Copilot
AI
Jul 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error message 'กรุณาเข้าสู่ระบบก่อนลงทะเบียน' is misleading for a group leaving function. It should indicate authentication is required for leaving a group.
| error: "กรุณาเข้าสู่ระบบก่อนลงทะเบียน", | |
| error: "กรุณาเข้าสู่ระบบก่อนออกจากกลุ่ม", // "Please log in before leaving the group" |
| export async function joinGroup( | ||
| inviteCode: string, | ||
| authToken?: string | ||
| ): Promise<ApiResponse<unknown>> { |
Copilot
AI
Jul 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The return type 'unknown' is too vague. Based on line 80, the API returns '{ message: string }', so the return type should be 'Promise<ApiResponse<{ message: string }>>' for better type safety.
| ): Promise<ApiResponse<unknown>> { | |
| ): Promise<ApiResponse<{ message: string }>> { |
| groupDefaultView?.classList.add("hidden"); | ||
| groupMemberView?.classList.remove("hidden"); | ||
| } else { | ||
| console.error("Failed to leave group before:", response.error); |
Copilot
AI
Jul 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error message 'Failed to leave group before:' is confusing and doesn't match the context. This appears to be logging an error for a failed join group operation, not a leave operation.
| console.error("Failed to leave group before:", response.error); | |
| console.error("Failed to join group:", response.error); |
| Authorization: `Bearer ${getAuthToken()}`, | ||
| }, | ||
| }); | ||
| const raw_data = reponse.data as EditProfileFormData; |
Copilot
AI
Jul 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Variable name 'reponse' is misspelled. It should be 'response'.
| illness: data.user.hasChronicDiseases ? data.user.illness : "", | ||
| }; | ||
|
|
||
| const reponse = await api.patch("/user/update", formData, { |
Copilot
AI
Jul 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Variable name 'reponse' is misspelled. It should be 'response'.
No description provided.