Skip to content

fix: return location#77

Merged
s3mng merged 1 commit intomainfrom
fix/0206
Feb 6, 2026
Merged

fix: return location#77
s3mng merged 1 commit intomainfrom
fix/0206

Conversation

@s3mng
Copy link
Collaborator

@s3mng s3mng commented Feb 6, 2026

PR 요약

변경 사항

Copilot AI review requested due to automatic review settings February 6, 2026 13:48
@s3mng s3mng merged commit 0a4f40e into main Feb 6, 2026
5 checks passed
Copy link

Copilot AI left a 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 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.

Comment on lines +161 to +165
// GPS 지원 확인
if (!navigator.geolocation) {
alert('이 브라우저에서는 GPS를 지원하지 않습니다.');
return;
}
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
};

const executeReturnAction = async (file: File) => {
const executeReturnAction = async (file: File, location: { lat: number; lng: number }) => {
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
const executeReturnAction = async (file: File, location: { lat: number; lng: number }) => {
const executeReturnAction = async (file: File, location?: { lat: number; lng: number }) => {

Copilot uses AI. Check for mistakes.
Comment on lines +200 to +201
// 3. 최종 반납 진행 (위치 정보 필수 전달)
await executeReturnAction(selectedFile, { lat: userLat, lng: userLng });
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant