Conversation
There was a problem hiding this comment.
Pull request overview
This PR aims to fix the handling of location data in the return flow. The changes modify how GPS coordinates are collected and validated during the item return process, and improves the user experience after borrowing items.
Changes:
- Modified the return submission flow to always collect user GPS coordinates before processing returns
- Changed the post-borrow navigation to redirect users to their dashboard instead of refreshing the item list
- Restructured GPS validation to check for browser support earlier in the process
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/pages/ReturnDetailPage.tsx | Refactored GPS validation logic, moved geolocation check earlier, made location parameter mandatory in executeReturnAction, and removed trailing comment whitespace |
| src/pages/ItemListPage.tsx | Removed refreshKey state mechanism and changed post-borrow behavior to navigate to dashboard instead of refreshing the list |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // GPS 지원 확인 | ||
| if (!navigator.geolocation) { | ||
| alert('이 브라우저에서는 GPS를 지원하지 않습니다.'); | ||
| return; | ||
| } |
There was a problem hiding this comment.
The GPS support check has been moved too early in the flow. This prevents users from returning items even when the club doesn't have location data configured. Previously, if a club had no location_lat/location_lng set, the return would proceed without GPS validation. Now, all returns are blocked if the browser doesn't support geolocation, regardless of whether the club requires location verification. This should be moved inside the conditional check at line 187, so GPS is only required when the club actually has location data configured.
| }; | ||
|
|
||
| const executeReturnAction = async (file: File) => { | ||
| const executeReturnAction = async (file: File, location: { lat: number; lng: number }) => { |
There was a problem hiding this comment.
The location parameter is now mandatory in the executeReturnAction function signature, but it's passed to returnItem which expects it to be optional. More importantly, this change forces location data to always be sent to the API, even for clubs that don't have location requirements. This breaks the previous behavior where clubs without location_lat/location_lng could accept returns without GPS data. The location parameter should remain optional to support clubs without location verification requirements.
| const executeReturnAction = async (file: File, location: { lat: number; lng: number }) => { | |
| const executeReturnAction = async (file: File, location?: { lat: number; lng: number }) => { |
| // 3. 최종 반납 진행 (위치 정보 필수 전달) | ||
| await executeReturnAction(selectedFile, { lat: userLat, lng: userLng }); |
There was a problem hiding this comment.
The comment states "최종 반납 진행 (위치 정보 필수 전달)" (Final return process with mandatory location information), but this is misleading and incorrect. The location should only be sent when the club actually has location requirements (location_lat and location_lng set). For clubs without location verification, sending user location data raises privacy concerns and is unnecessary. The call to executeReturnAction should conditionally pass location only when clubData.location_lat and clubData.location_lng exist.
PR 요약
변경 사항