diff --git a/react/src/api/tag.api.ts b/react/src/api/tag.api.ts new file mode 100644 index 0000000..040f2c8 --- /dev/null +++ b/react/src/api/tag.api.ts @@ -0,0 +1,40 @@ +import { apiClient } from "./client"; +import type { ApiResponse } from "@/types/api"; +import type { + TagListRequest, + TagListResponse, + TagResponse, + CreateTagRequest, + UpdateTagRequest, + DeleteTagRequest, +} from "@/features/tag/types"; + +/** 태그 목록 조회 (serviceCode 생략 시 전체 서비스) */ +export function fetchTagList(data: TagListRequest, serviceCode?: string) { + return apiClient.post>( + "/v1/in/tag/list", + data, + serviceCode ? { headers: { "X-Service-Code": serviceCode } } : undefined, + ); +} + +/** 태그 생성 */ +export function createTag(data: CreateTagRequest, serviceCode: string) { + return apiClient.post>("/v1/in/tag/create", data, { + headers: { "X-Service-Code": serviceCode }, + }); +} + +/** 태그 수정 */ +export function updateTag(data: UpdateTagRequest, serviceCode: string) { + return apiClient.post>("/v1/in/tag/update", data, { + headers: { "X-Service-Code": serviceCode }, + }); +} + +/** 태그 삭제 */ +export function deleteTag(data: DeleteTagRequest, serviceCode: string) { + return apiClient.post>("/v1/in/tag/delete", data, { + headers: { "X-Service-Code": serviceCode }, + }); +} diff --git a/react/src/features/service/types.ts b/react/src/features/service/types.ts index 1af9996..7a06dce 100644 --- a/react/src/features/service/types.ts +++ b/react/src/features/service/types.ts @@ -26,6 +26,7 @@ export interface PlatformCredentialSummary { // 서비스 목록 항목 export interface ServiceSummary { + serviceId: number; serviceCode: string; serviceName: string; serviceIcon?: string; diff --git a/react/src/features/tag/components/TagAddModal.tsx b/react/src/features/tag/components/TagAddModal.tsx index 4bd9200..468ef0d 100644 --- a/react/src/features/tag/components/TagAddModal.tsx +++ b/react/src/features/tag/components/TagAddModal.tsx @@ -1,14 +1,14 @@ import { useState, useRef, useEffect } from "react"; import useShake from "@/hooks/useShake"; -import { SERVICE_OPTIONS } from "../types"; interface TagAddModalProps { open: boolean; onClose: () => void; onSave: (data: { name: string; service: string; description: string }) => void; + serviceOptions: string[]; } -export default function TagAddModal({ open, onClose, onSave }: TagAddModalProps) { +export default function TagAddModal({ open, onClose, onSave, serviceOptions }: TagAddModalProps) { const { triggerShake, cls } = useShake(); const [name, setName] = useState(""); @@ -107,9 +107,10 @@ export default function TagAddModal({ open, onClose, onSave }: TagAddModalProps) type="text" value={name} onChange={(e) => { - setName(e.target.value); + if (e.target.value.length <= 50) setName(e.target.value); if (e.target.value.trim()) setNameError(false); }} + maxLength={50} placeholder="태그 이름을 입력하세요" className={`w-full h-[38px] px-3 border rounded-lg text-sm focus:ring-2 focus:ring-primary/20 focus:border-primary outline-none transition-all ${ nameError @@ -154,7 +155,7 @@ export default function TagAddModal({ open, onClose, onSave }: TagAddModalProps) {serviceOpen && (
    - {SERVICE_OPTIONS.map((opt) => ( + {serviceOptions.map((opt) => (
  • { @@ -192,11 +193,17 @@ export default function TagAddModal({ open, onClose, onSave }: TagAddModalProps)