Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions apps/web/src/app/record/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import RecordDetailClient from "@/components/record/RecordDetailClient";
import RecordDetailViewTracker from "@/components/record/RecordDetailViewTracker";
import { AUTH_COOKIE } from "@/constants/authCookies";
import { getDiariesByUuid } from "@/services/diaryService";
import { handleServerError } from "@/utils/serverErrorHandler";

type RecordData = {
id: string;
Expand Down Expand Up @@ -93,11 +94,19 @@ export default async function RecordDetailPage({
}
}
} catch (error) {
serverError = error instanceof Error ? error.message : "기록을 불러오는 중 오류가 발생했습니다";
// 401·5xx는 다른 서버 페이지처럼 오류 화면으로 보냄 (GLB-242)
handleServerError(error);
// 그 밖의 실패는 API 오류 원문 대신 고정 문구로 안내함 (GLB-240)
serverError = "여행 기록을 불러오는 데 실패했습니다. 잠시 후 다시 시도해주세요.";
}
}

const initialScrollIndex = scrollIndexParam ? Number(scrollIndexParam) : 0;
// 범위 밖이거나 숫자가 아닌 scrollIndex로 들어와도 빈 화면이 되지 않도록 기록 범위 안으로 맞춤 (GLB-153)
const parsedScrollIndex = Number(scrollIndexParam);
const lastRecordIndex = Math.max(initialRecords.length - 1, 0);
const initialScrollIndex = Number.isInteger(parsedScrollIndex)
? Math.min(Math.max(parsedScrollIndex, 0), lastRecordIndex)
: 0;

const selectedRecord = initialRecords.find(r => r.cityId === cityId);

Expand Down
29 changes: 16 additions & 13 deletions apps/web/src/components/record/RecordDetailClient.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -169,19 +169,22 @@ const RecordDetailClient = ({

const recordContent =
countryRecords.length === 1 ? (
<RecordCard
id={id}
images={images}
imageMetadata={imageMetadata}
userName={userName}
cityName={city}
userAvatar={userAvatar}
description={description}
reactions={reactions}
isOwner={isOwner}
showScrollHint={shouldShowScrollHint}
isFirstRecord={true}
/>
// 기록이 여러 개일 때 RecordScrollContainer가 주는 touch-action을 1개일 때도 줘서 사진 핀치 중 페이지가 함께 확대되지 않게 함 (GLB-265)
<div className="w-full h-full" style={{ touchAction: "pan-y" }}>
<RecordCard
id={id}
images={images}
imageMetadata={imageMetadata}
userName={userName}
cityName={city}
userAvatar={userAvatar}
description={description}
reactions={reactions}
isOwner={isOwner}
showScrollHint={shouldShowScrollHint}
isFirstRecord={true}
/>
</div>
) : (
<>
<RecordScrollHint show={shouldShowScrollHint} />
Expand Down
10 changes: 3 additions & 7 deletions apps/web/src/services/bookmarkService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,7 @@ export const getBookmarks = async (token?: string, useToken = true): Promise<Boo
throw error;
}

if (error instanceof Error) {
throw new Error(`저장된 지구본 목록을 불러오는 데 실패했습니다: ${error.message}`);
}
// 화면에는 API 오류 원문 대신 고정 문구를 보여 줌 (GLB-240)
throw new Error("저장된 지구본 목록을 불러오는 데 실패했습니다. 잠시 후 다시 시도해주세요.");
}
};
Expand Down Expand Up @@ -119,10 +117,8 @@ export const removeBookmark = async (targetMemberId: number): Promise<void> => {

try {
await apiDelete(`/api/v1/bookmarks/${targetMemberId}`, undefined, token);
} catch (error) {
if (error instanceof Error) {
throw new Error(`지구본 저장 취소에 실패했습니다: ${error.message}`);
}
} catch {
// 화면에는 API 오류 원문 대신 고정 문구를 보여 줌 (GLB-240)
throw new Error("지구본 저장을 취소하는 데 실패했습니다. 잠시 후 다시 시도해주세요.");
}
};
2 changes: 2 additions & 0 deletions apps/web/src/services/diaryService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,8 @@ export const getDiariesByUuid = async (uuid: string, token?: string): Promise<Di
);
} catch (error) {
logger.error("[getDiariesByUuid] 실패:", error);
// 서버 페이지가 handleServerError로 401·5xx를 구분할 수 있도록 상태 코드를 유지함 (GLB-242)
if (error instanceof ApiError) throw error;
throw new Error("여행 기록을 불러오는 데 실패했습니다. 잠시 후 다시 시도해주세요.");
}
};
Expand Down
Loading