Skip to content

Conversation

@sean2337
Copy link
Collaborator

@sean2337 sean2337 commented Jul 31, 2024

스페이스 전체 뷰 페이지 개발 및 로그인 로직 수정


🏄🏼‍♂️‍ Summary (요약)

image image
  • 스페이스 전제 뷰 퍼블리싱 및 API 연동 완료
  • 스페이스 상세 보기 1차 퍼블리싱 (디자인 나오기 전이라 일단 만들어둔 것만 올립니다.)
  • 로그인 로직 수정 반영 ( 로그인 API 에러 상태 코드 변경에 따라 로직을 수정했습니다. )

🫨 Describe your Change (변경사항)

  • 스페이스 전체 뷰 퍼블리싱 및 API 연동 완료 (무한 스크롤 기능 포함)
  1. src/app/space/SpaceViewPage.tsx => 전체 퍼블리싱
  2. src/api/restrospect/index.tsx => API 로직
  3. src/component/view => 해당 페이지에서만 쓰는 컴포넌트 정리
  • 스페이스 상세 보기 1차 퍼블리싱
  1. src/app/home/RetrospectViewPage.tsx => 전체 퍼블리싱
  • 로그인 로직 수정
  1. 400 : 로그인 실패 => 데이터베이스에 존재하지 않음. => 회원가입 필요
  2. 404: 잘못된 접근
    => 이러한 접근으로 400으로 상태 코드를 수정하였고, 이를 반영하여 코드를 수정했습니다.

🧐 Issue number and link (참고)

📚 Reference (참조)

@sean2337 sean2337 added the 🚀 feature New feature or request label Jul 31, 2024
@sean2337 sean2337 self-assigned this Jul 31, 2024
Copy link
Member

@klmhyeonwoo klmhyeonwoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

넘나 고생하셨습니다 : )

if (loading || !hasNextPage) return;

setLoading(true);
spaceFetch(cursorId, selectedView, 5)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tanstack-

Comment on lines 13 to 45
export const spaceFetch = async (cursorId: number, category: string, pageSize: number) => {
const params = category !== "ALL" ? { cursorId: cursorId, category: category, pageSize: pageSize } : { cursorId: cursorId, pageSize: pageSize };

const response = await api.get<SpaceFetchResponse>("/api/space/list", {
params: params,
});
return response.data;
};

type RestrospectResponse = {
layerCount: number;
retrospects: {
retrospectId: number;
title: string;
introduction: string;
isWrite: boolean;
retrospectStatus: "PROCEEDING" | "DONE";
writeCount: number;
totalCount: number;
}[];
};

// space에 있는 회고록 획득 함수
export const spaceRestrospectFetch = async (spaceId: number) => {
const response = await api.get<RestrospectResponse>(`/space/${spaceId}/retrospect`);
return response.data;
};

// spaceId에 따른 정보 얻는 함수
export const spaceInfoFetch = async (spaceId: number) => {
const response = await api.get<Space>(`api/space/${spaceId}`);
return response.data;
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

추후 tanstack 훅 형태로 변경될 예정 맞을까요?!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

현재 변경하였습니다~

import { Spacing } from "@/component/common/Spacing";
import { Typography } from "@/component/common/typography";

type RestrospectType = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RetrospectType 이라는 명칭도 물론 좋지만, 공통 Type으로 RetrospectType이라는 친구를 사용하고 있거든요! 회고 유형 자체의 타입을 의미하는! (ex. number / combobox / plain_text ...) 이름이 중복되어서 다른 이름으로 사용해보는것도 좋을 것 같다는 생각입니다! ex) RetrospectBoxType

@sean2337 sean2337 added the 🚧 still working 수정 중입니다. 아직 리뷰하지 말아주세요! label Aug 2, 2024
@klmhyeonwoo klmhyeonwoo marked this pull request as draft August 2, 2024 08:17
@sean2337 sean2337 marked this pull request as ready for review August 2, 2024 14:08
@github-actions github-actions bot requested a review from klmhyeonwoo August 2, 2024 14:09
@sean2337 sean2337 removed the 🚧 still working 수정 중입니다. 아직 리뷰하지 말아주세요! label Aug 2, 2024
Copy link
Collaborator

@donghunee donghunee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

�🍀고생하셨습니다🍀 갓시현!!

Comment on lines 14 to 20
const params = category !== "ALL" ? { cursorId: cursorId, category: category, pageSize: pageSize } : { cursorId: cursorId, pageSize: pageSize };

const response = await api.get<SpaceFetchResponse>("/api/space/list", {
params: params,
});
return response.data;
};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const params = category !== "ALL" ? { cursorId: cursorId, category: category, pageSize: pageSize } : { cursorId: cursorId, pageSize: pageSize };
const response = await api.get<SpaceFetchResponse>("/api/space/list", {
params: params,
});
return response.data;
};
const response = await api.get<SpaceFetchResponse>("/api/space/list", {
params: {
cursorId,
pageSize,
...(category !== ALL && { category })
},
});
return response.data;
};

요렇게 단순화 할 수 있을 것 같아요..!!

{ viewName: "전체", selected: true },
{ viewName: "개인", selected: false },
{ viewName: "", selected: false },
{ viewName: "ALL", selected: true },
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

viewName type을 string보단 union이나 enum으로 설정하는 것이 좋아보여요~!

Copy link
Member

@leeminhee119 leeminhee119 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생하셨슴다 !!

return response.data;
};

export const useGetSpaceAndRetrospect = (spaceId?: string): UseQueryOptions<RestrospectResponse, Error, RestrospectResponse, [string]> => ({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

파일이름도 동일하게 작성하면 좋을 것 같아요 !!

Comment on lines +49 to +52
if (getSpaceInfo.isSuccess && getRetrospects.isSuccess) {
setSpaceInfo(getSpaceInfo.data);
setLayerCount(getRetrospects.data?.layerCount);
setRestrospectArr(getRetrospects.data?.retrospects);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

useQuery가 반환하는 데이터를 바로 사용하지 않고 useState로 한 번 더 감싸는 이유가 있을까요 ?!

};

const spaceRestrospectFetch = async (spaceId: string | undefined) => {
const response = await api.get<RestrospectResponse>(`/space/${spaceId}/retrospect`);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

헉 여기다 데이터 타입을 지정해주면 되는구나 !! 나도 수정해야게따

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

어엇 이거 common에 Tag 있는데 좀 다른 걸까요 ??

@sean2337 sean2337 merged commit 331d445 into develop Aug 3, 2024
@sean2337 sean2337 deleted the feat/35/SpaceDetail branch August 3, 2024 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🚀 feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants