Docs: Update IR Valuation SPA routing fix with verification
This commit is contained in:
parent
2c9e31f271
commit
84f84a0a1f
@ -85,27 +85,36 @@ sudo systemctl reload nginx
|
|||||||
- `App.tsx`에 base path 처리 로직 추가
|
- `App.tsx`에 base path 처리 로직 추가
|
||||||
- `useLocation` hook으로 `/ir-valuation` base path를 제거하고 라우팅
|
- `useLocation` hook으로 `/ir-valuation` base path를 제거하고 라우팅
|
||||||
|
|
||||||
**파일**: `src/App.tsx:14-25`
|
**파일**: `src/App.tsx:14-30`
|
||||||
```typescript
|
```typescript
|
||||||
function Router() {
|
function Router() {
|
||||||
const [location] = useLocation();
|
const [location] = useLocation();
|
||||||
const basePath = "/ir-valuation";
|
const basePath = "/ir-valuation";
|
||||||
const normalizedLocation = location.startsWith(basePath)
|
|
||||||
? location.slice(basePath.length) || "/"
|
// Remove base path from location for routing
|
||||||
: location;
|
// 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 (
|
return (
|
||||||
<Switch location={normalizedLocation}>
|
<Switch location={normalizedLocation}>
|
||||||
<Route path="/" component={IRValuationPage} />
|
<Route path="/" component={IRValuationPage} />
|
||||||
<Route component={() => <div>404 Not Found</div>} />
|
<Route component={() => <div>404 Not Found - Location: {location}, Normalized: {normalizedLocation}</div>} />
|
||||||
</Switch>
|
</Switch>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
**검증**:
|
**검증**:
|
||||||
- `https://ro-being.com/ir-valuation/` 접근 시 IR 평가 페이지 정상 표시
|
- `https://ro-being.com/ir-valuation/` 접근 시 IR 평가 페이지 정상 표시 확인
|
||||||
- 네트워크 요청 모두 200 OK 확인
|
- 네트워크 요청 모두 200 OK 확인
|
||||||
|
- ChatGPT 스타일 UI 정상 렌더링 (헤더, 업로드 버튼, 채팅 입력창)
|
||||||
|
|
||||||
## 다음 단계
|
## 다음 단계
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user