Docs: Update IR Valuation SPA routing fix with verification

This commit is contained in:
happybell80 2025-11-28 17:03:26 +09:00
parent 2c9e31f271
commit 84f84a0a1f

View File

@ -85,27 +85,36 @@ sudo systemctl reload nginx
- `App.tsx`에 base path 처리 로직 추가
- `useLocation` hook으로 `/ir-valuation` base path를 제거하고 라우팅
**파일**: `src/App.tsx:14-25`
**파일**: `src/App.tsx:14-30`
```typescript
function Router() {
const [location] = useLocation();
const basePath = "/ir-valuation";
const normalizedLocation = location.startsWith(basePath)
? location.slice(basePath.length) || "/"
: location;
// Remove base path from location for routing
// Handle both /ir-valuation and /ir-valuation/ cases
let normalizedLocation = location;
if (location.startsWith(basePath + "/") || location === basePath) {
normalizedLocation = location.slice(basePath.length) || "/";
// Remove trailing slash if present (except root)
if (normalizedLocation !== "/" && normalizedLocation.endsWith("/")) {
normalizedLocation = normalizedLocation.slice(0, -1);
}
}
return (
<Switch location={normalizedLocation}>
<Route path="/" component={IRValuationPage} />
<Route component={() => <div>404 Not Found</div>} />
<Route component={() => <div>404 Not Found - Location: {location}, Normalized: {normalizedLocation}</div>} />
</Switch>
);
}
```
**검증**:
- `https://ro-being.com/ir-valuation/` 접근 시 IR 평가 페이지 정상 표시
- `https://ro-being.com/ir-valuation/` 접근 시 IR 평가 페이지 정상 표시 확인
- 네트워크 요청 모두 200 OK 확인
- ChatGPT 스타일 UI 정상 렌더링 (헤더, 업로드 버튼, 채팅 입력창)
## 다음 단계