Fix: 백엔드 api 응답 형식 변경에 따른 수정
This commit is contained in:
parent
6b542b5b0f
commit
c145bc32e4
@ -1,5 +1,5 @@
|
||||
import api from '@/api/axiosConfig';
|
||||
import { ProjectListResponse, ProjectResponse, ProjectMemberRequest, ProjectMemberResponse } from '@/types';
|
||||
import { ProjectResponse, ProjectMemberRequest, ProjectMemberResponse } from '@/types';
|
||||
|
||||
export async function getProjectList(
|
||||
workspaceId: number,
|
||||
@ -8,7 +8,7 @@ export async function getProjectList(
|
||||
limit: number = 50
|
||||
) {
|
||||
return api
|
||||
.get<ProjectListResponse>(`/workspaces/${workspaceId}/projects`, {
|
||||
.get<ProjectResponse[]>(`/workspaces/${workspaceId}/projects`, {
|
||||
params: {
|
||||
memberId,
|
||||
lastProjectId,
|
||||
|
@ -19,8 +19,7 @@ export default function AdminProjectSidebar(): JSX.Element {
|
||||
const { data: workspaceData } = useWorkspaceQuery(Number(workspaceId), memberId);
|
||||
const workspaceTitle = workspaceData?.title || `Workspace-${workspaceId}`;
|
||||
|
||||
const { data: projectsResponse } = useProjectListQuery(Number(workspaceId), memberId);
|
||||
const projects = projectsResponse?.workspaceResponses ?? [];
|
||||
const { data: projects } = useProjectListQuery(Number(workspaceId), memberId);
|
||||
|
||||
const createProject = useCreateProjectQuery();
|
||||
|
||||
|
@ -30,7 +30,7 @@ export default function WorkspaceLayout() {
|
||||
|
||||
useEffect(() => {
|
||||
if (!projectListData) return;
|
||||
const projects = projectListData.workspaceResponses.map(
|
||||
const projects = projectListData.map(
|
||||
(project): Project => ({
|
||||
id: project.id,
|
||||
name: project.title,
|
||||
|
@ -21,7 +21,7 @@ export default function ReviewRequest(): JSX.Element {
|
||||
const profile = useAuthStore((state) => state.profile);
|
||||
const memberId = profile?.id || 0;
|
||||
|
||||
const { data: projectList } = useProjectListQuery(Number(workspaceId), memberId);
|
||||
const { data: projects } = useProjectListQuery(Number(workspaceId), memberId);
|
||||
|
||||
const {
|
||||
register,
|
||||
@ -63,8 +63,8 @@ export default function ReviewRequest(): JSX.Element {
|
||||
<SelectValue placeholder="프로젝트를 선택하세요" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
{projectList?.workspaceResponses.length ? (
|
||||
projectList.workspaceResponses.map((project) => (
|
||||
{projects.length ? (
|
||||
projects.map((project) => (
|
||||
<SelectItem
|
||||
key={project.id}
|
||||
value={project.id.toString()}
|
||||
|
@ -16,7 +16,7 @@ export default function WorkspaceBrowseDetail() {
|
||||
const memberId = profile?.id ?? 0;
|
||||
|
||||
const { data: workspaceData } = useWorkspaceQuery(workspaceId, memberId);
|
||||
const { data: projectsResponse, isError } = useProjectListQuery(workspaceId, memberId);
|
||||
const { data: projects, isError } = useProjectListQuery(workspaceId, memberId);
|
||||
|
||||
const createProject = useCreateProjectQuery();
|
||||
|
||||
@ -28,8 +28,6 @@ export default function WorkspaceBrowseDetail() {
|
||||
});
|
||||
};
|
||||
|
||||
const projects: ProjectResponse[] = projectsResponse?.workspaceResponses ?? [];
|
||||
|
||||
return (
|
||||
<div className="flex h-full w-full flex-col gap-8 px-6 py-4">
|
||||
<HeaderSection
|
||||
|
Loading…
Reference in New Issue
Block a user