feat(WEB): 헤더 알림 드롭다운 TodayIssue API 연동
- TodayIssue 타입 정의 파일 생성 (src/types/today-issue.ts) - TodayIssue API 서비스 함수 생성 (src/lib/api/today-issue.ts) - getUnreadTodayIssues: 읽지 않은 알림 목록 조회 - markTodayIssueAsRead: 개별 읽음 처리 - markAllTodayIssuesAsRead: 전체 읽음 처리 - AuthenticatedLayout 알림 드롭다운 API 연동 - MOCK_NOTIFICATIONS 제거, 실제 API 연동 - 30초 폴링으로 알림 데이터 갱신 - 알림 클릭 시 읽음 처리 + 페이지 이동 - 모두 읽음 버튼 기능 구현 - 벨 애니메이션 (읽지 않은 알림 있을 때만)
This commit is contained in:
71
src/types/today-issue.ts
Normal file
71
src/types/today-issue.ts
Normal file
@@ -0,0 +1,71 @@
|
||||
/**
|
||||
* TodayIssue 관련 타입 정의
|
||||
* API: api/app/Swagger/v1/TodayIssueApi.php 참조
|
||||
*/
|
||||
|
||||
/** 알림 뱃지 타입 (헤더 알림용) */
|
||||
export type TodayIssueBadge =
|
||||
| '수주등록'
|
||||
| '추심이슈'
|
||||
| '안전재고'
|
||||
| '지출 승인대기'
|
||||
| '세금 신고'
|
||||
| '결재 요청'
|
||||
| '신규거래처';
|
||||
|
||||
/** 알림 설정 타입 */
|
||||
export type NotificationType =
|
||||
| 'sales_order' // 수주등록
|
||||
| 'new_vendor' // 신규거래처
|
||||
| 'approval_request' // 결재 요청
|
||||
| 'bad_debt' // 추심이슈
|
||||
| 'safety_stock' // 안전재고
|
||||
| 'expected_expense' // 지출 승인대기
|
||||
| 'vat_report'; // 세금 신고
|
||||
|
||||
/**
|
||||
* 읽지 않은 이슈 항목 (헤더 알림용)
|
||||
* TodayIssueUnreadItem 스키마
|
||||
*/
|
||||
export interface TodayIssueUnreadItem {
|
||||
id: number;
|
||||
badge: TodayIssueBadge;
|
||||
notification_type: NotificationType;
|
||||
content: string;
|
||||
path: string | null;
|
||||
needs_approval: boolean;
|
||||
time: string;
|
||||
created_at: string; // ISO 8601
|
||||
}
|
||||
|
||||
/**
|
||||
* 읽지 않은 이슈 목록 응답
|
||||
* TodayIssueUnreadResponse 스키마
|
||||
*/
|
||||
export interface TodayIssueUnreadResponse {
|
||||
items: TodayIssueUnreadItem[];
|
||||
total: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* 읽지 않은 이슈 개수 응답
|
||||
* TodayIssueUnreadCountResponse 스키마
|
||||
*/
|
||||
export interface TodayIssueUnreadCountResponse {
|
||||
count: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* 모든 이슈 읽음 처리 응답
|
||||
* TodayIssueMarkAllReadResponse 스키마
|
||||
*/
|
||||
export interface TodayIssueMarkAllReadResponse {
|
||||
count: number;
|
||||
}
|
||||
|
||||
/** API 응답 공통 래퍼 */
|
||||
export interface ApiResponse<T> {
|
||||
success: boolean;
|
||||
message: string;
|
||||
data: T;
|
||||
}
|
||||
Reference in New Issue
Block a user