docs: CRUD-API-GUIDE 게시판 프론트엔드 파일 참조 갱신
- BoardListTable → BoardView/BoardWriteForm/BoardDetailView로 변경 - 권한 기반 UI 분기 코드 예시를 실제 구현과 일치하도록 수정 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
부모
6bdea97b49
커밋
db7f435717
@ -1387,21 +1387,22 @@ export async function createBoardPost(input: CreateBoardPostInput): Promise<{ sn
|
|||||||
|
|
||||||
#### 권한 기반 UI 분기
|
#### 권한 기반 UI 분기
|
||||||
|
|
||||||
**파일**: `frontend/src/tabs/board/components/BoardListTable.tsx`
|
**파일**: `frontend/src/tabs/board/components/BoardView.tsx`
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import { useAuthStore } from '@common/store/authStore';
|
import { useAuthStore } from '@common/store/authStore';
|
||||||
|
|
||||||
const hasPermission = useAuthStore((s) => s.hasPermission);
|
const hasPermission = useAuthStore((s) => s.hasPermission);
|
||||||
|
|
||||||
// 카테고리별 서브리소스 CREATE 권한 확인
|
// 서브탭 기준 글쓰기 권한 리소스 결정
|
||||||
const canWrite = selectedCategory
|
const getWriteResource = () => {
|
||||||
? hasPermission(`board:${selectedCategory.toLowerCase()}`, 'CREATE')
|
if (activeSubTab === 'all') return 'board';
|
||||||
: hasPermission('board', 'CREATE');
|
return `board:${activeSubTab}`;
|
||||||
|
};
|
||||||
|
|
||||||
// 글쓰기 버튼 조건부 렌더링
|
// 글쓰기 버튼 조건부 렌더링
|
||||||
{canWrite && (
|
{hasPermission(getWriteResource(), 'CREATE') && (
|
||||||
<button onClick={onWriteClick}>글쓰기</button>
|
<button onClick={handleWriteClick}>글쓰기</button>
|
||||||
)}
|
)}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -1430,4 +1431,6 @@ const canWrite = selectedCategory
|
|||||||
| 백엔드 | `backend/src/board/boardRouter.ts` | 라우터 + requirePermission |
|
| 백엔드 | `backend/src/board/boardRouter.ts` | 라우터 + requirePermission |
|
||||||
| 백엔드 | `backend/src/server.ts` | boardRouter 등록 |
|
| 백엔드 | `backend/src/server.ts` | boardRouter 등록 |
|
||||||
| 프론트 | `frontend/src/tabs/board/services/boardApi.ts` | API 서비스 |
|
| 프론트 | `frontend/src/tabs/board/services/boardApi.ts` | API 서비스 |
|
||||||
| 프론트 | `frontend/src/tabs/board/components/BoardListTable.tsx` | 목록 UI (API 연동) |
|
| 프론트 | `frontend/src/tabs/board/components/BoardView.tsx` | 목록/상세/작성 통합 뷰 (API 연동) |
|
||||||
|
| 프론트 | `frontend/src/tabs/board/components/BoardWriteForm.tsx` | 게시글 작성/수정 폼 (API 호출) |
|
||||||
|
| 프론트 | `frontend/src/tabs/board/components/BoardDetailView.tsx` | 게시글 상세 보기 (API 호출) |
|
||||||
|
|||||||
불러오는 중...
Reference in New Issue
Block a user