diff --git a/frontend/src/api/authApi.ts b/frontend/src/api/authApi.ts index d13a41e..9a500ba 100644 --- a/frontend/src/api/authApi.ts +++ b/frontend/src/api/authApi.ts @@ -6,9 +6,9 @@ export async function reissueToken() { } export async function getProfile() { - return api - .get('/auth/profile', { - withCredentials: true, - }) - .then(({ data }) => data); + return api.get('/auth/profile').then(({ data }) => data); +} + +export async function logout() { + return api.post('/auth/logout').then(({ data }) => data); } diff --git a/frontend/src/api/axiosConfig.ts b/frontend/src/api/axiosConfig.ts index 600f8db..c6b8e14 100644 --- a/frontend/src/api/axiosConfig.ts +++ b/frontend/src/api/axiosConfig.ts @@ -27,9 +27,8 @@ api.interceptors.response.use( return api .post(REFRESH_URL) .then(({ data }) => { - console.log(data); const { accessToken } = data; - useAuthStore.getState().setLoggedIn(true, accessToken); + useAuthStore.getState().setToken(accessToken); if (error.config) { return api(error.config); } diff --git a/frontend/src/api/lablingApi.ts b/frontend/src/api/lablingApi.ts index 2d103ec..0c922c9 100644 --- a/frontend/src/api/lablingApi.ts +++ b/frontend/src/api/lablingApi.ts @@ -10,14 +10,6 @@ export async function saveImageLabels( return api.post(`/projects/${projectId}/images/${imageId}/label`, data).then(({ data }) => data); } -export async function runAutoLabel(projectId: number, memberId: number) { - return api - .post( - `/projects/${projectId}/label/auto`, - {}, - { - params: { memberId }, - } - ) - .then(({ data }) => data); +export async function runAutoLabel(projectId: number, modelId = 1) { + return api.post(`/projects/${projectId}/auto`, { modelId }).then(({ data }) => data); } diff --git a/frontend/src/components/CanvasControlBar/index.stories.tsx b/frontend/src/components/CanvasControlBar/index.stories.tsx index a910ce8..52d945d 100644 --- a/frontend/src/components/CanvasControlBar/index.stories.tsx +++ b/frontend/src/components/CanvasControlBar/index.stories.tsx @@ -6,4 +6,9 @@ export default { component: CanvasControlBar, }; -export const Default = () => {}} />; +export const Default = () => ( + {}} + projectType="segmentation" + /> +); diff --git a/frontend/src/components/CanvasControlBar/index.tsx b/frontend/src/components/CanvasControlBar/index.tsx index 56fd7c1..8f86cbf 100644 --- a/frontend/src/components/CanvasControlBar/index.tsx +++ b/frontend/src/components/CanvasControlBar/index.tsx @@ -2,16 +2,22 @@ import useCanvasStore from '@/stores/useCanvasStore'; import { LucideIcon, MousePointer2, PenTool, Save, Square } from 'lucide-react'; import { cn } from '@/lib/utils'; -export default function CanvasControlBar({ saveJson }: { saveJson: () => void }) { +export default function CanvasControlBar({ + saveJson, + projectType, +}: { + saveJson: () => void; + projectType: 'classification' | 'detection' | 'segmentation'; +}) { const drawState = useCanvasStore((state) => state.drawState); const setDrawState = useCanvasStore((state) => state.setDrawState); const buttonBaseClassName = 'rounded-lg p-2 transition-colors '; const buttonClassName = 'hover:bg-gray-100'; const activeButtonClassName = 'bg-primary stroke-white'; + const controls: { [key: string]: LucideIcon } = { pointer: MousePointer2, - rect: Square, - pen: PenTool, + ...(projectType === 'segmentation' ? { pen: PenTool } : { rect: Square }), }; return ( @@ -31,7 +37,7 @@ export default function CanvasControlBar({ saveJson }: { saveJson: () => void }) ); })} - +
) : (
diff --git a/frontend/src/components/WorkspaceBrowseLayout/index.tsx b/frontend/src/components/WorkspaceBrowseLayout/index.tsx index d5def81..018bd50 100644 --- a/frontend/src/components/WorkspaceBrowseLayout/index.tsx +++ b/frontend/src/components/WorkspaceBrowseLayout/index.tsx @@ -8,15 +8,15 @@ import useWorkspaceListQuery from '@/queries/workspaces/useWorkspaceListQuery'; import useCreateWorkspaceQuery from '@/queries/workspaces/useCreateWorkspaceQuery'; export default function WorkspaceBrowseLayout() { - const { profile, isLoggedIn } = useAuthStore(); + const { profile } = useAuthStore(); const memberId = profile?.id ?? 0; const navigate = useNavigate(); useEffect(() => { - if (!isLoggedIn || memberId == 0) { + if (memberId == 0) { navigate('/'); } - }, [isLoggedIn, memberId, navigate]); + }, [memberId, navigate]); const { data: workspacesResponse } = useWorkspaceListQuery(memberId ?? 0); const createWorkspace = useCreateWorkspaceQuery(); diff --git a/frontend/src/components/WorkspaceSidebar/ProjectStructure.tsx b/frontend/src/components/WorkspaceSidebar/ProjectStructure.tsx index 8d1155b..216631f 100644 --- a/frontend/src/components/WorkspaceSidebar/ProjectStructure.tsx +++ b/frontend/src/components/WorkspaceSidebar/ProjectStructure.tsx @@ -7,12 +7,14 @@ import useCanvasStore from '@/stores/useCanvasStore'; import { Button } from '../ui/button'; import { useEffect } from 'react'; import WorkspaceDropdownMenu from '../WorkspaceDropdownMenu'; +import useAutoLabelQuery from '@/queries/projects/useAutoLabelQuery'; import useProjectStore from '@/stores/useProjectStore'; export default function ProjectStructure({ project }: { project: Project }) { const setProject = useProjectStore((state) => state.setProject); const image = useCanvasStore((state) => state.image); const { data: folderData, refetch } = useFolderQuery(project.id.toString(), 0); + const requestAutoLabel = useAutoLabelQuery(); useEffect(() => { setProject(project); @@ -60,7 +62,17 @@ export default function ProjectStructure({ project }: { project: Project }) { // 404 에러 방지 + // 404 에러 방지 ) : ( <>