Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge :: 공지사항 api 연동 #59

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open

Conversation

eejx0
Copy link
Contributor

@eejx0 eejx0 commented Mar 25, 2024

특이사항

관련 이슈

@eejx0 eejx0 added the 기능 추가 새로운 기능 요청을 나타냅니다. label Mar 25, 2024
@eejx0 eejx0 requested a review from a team March 25, 2024 14:22
@eejx0 eejx0 self-assigned this Mar 25, 2024
@eejx0 eejx0 requested review from KANGYONGSU23 and removed request for a team March 25, 2024 14:22
src/apis/notice/index.ts Outdated Show resolved Hide resolved
src/apis/notice/index.ts Outdated Show resolved Hide resolved
src/apis/notice/index.ts Outdated Show resolved Hide resolved
src/components/notice/AttachedBox.tsx Outdated Show resolved Hide resolved
package.json Show resolved Hide resolved
src/apis/notice/index.ts Outdated Show resolved Hide resolved
src/apis/notice/index.ts Outdated Show resolved Hide resolved
src/apis/notice/index.ts Outdated Show resolved Hide resolved
src/app/mypage/notice/detail/[id]/page.tsx Outdated Show resolved Hide resolved
src/components/notice/AttachedBox.tsx Outdated Show resolved Hide resolved
src/components/notice/AttachedBox.tsx Outdated Show resolved Hide resolved
src/components/notice/AttachedBox.tsx Outdated Show resolved Hide resolved
src/components/notice/NoticeListTable.tsx Outdated Show resolved Hide resolved
@JJIIIINN
Copy link
Member

JJIIIINN commented Apr 8, 2024

코멘트 반영하고 있는 건가요?

Comment on lines +13 to +28
try {
const { data } = await instance.get(`${process.env.NEXT_PUBLIC_BASE_URL}/notices`);
const fetchedNotices: NoticeListResponse[] = data.notices.map((notice: any) => ({
id: notice.id,
title: notice.title,
created_at: new Date(notice.created_at).toISOString()
}));
setNotices(fetchedNotices);
} catch (error: any) {
append({
title: "",
message: "공지사항 리스트 조회에 실패하였습니다.",
type: "RED",
});
}
};
Copy link
Member

Choose a reason for hiding this comment

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

try catch 말고 then catch문으로 통일 합시다

Comment on lines 18 to 21
<h1 className="font-[700] text-[28px]">{noticeDetail?.title}</h1>
<h2 className="font-[500] text-[20px] mt-[20px]">{noticeDetail?.created_at.substring(0, 10)}</h2>
<p className="font-[400] text-[16px] mt-[28px] whitespace-pre-line">{noticeDetail?.content}</p>
<AttachedBox props={noticeDetail?.attachments || []} />
Copy link
Member

@KANGYONGSU23 KANGYONGSU23 Apr 19, 2024

Choose a reason for hiding this comment

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

noticeDetail 비구조화 할당 합시다.

Comment on lines +14 to +29
try {
const response = await axios.get(`${process.env.NEXT_PUBLIC_IMAGE_URL}/${attachment.url}`, {
responseType: 'blob'
});

const url = window.URL.createObjectURL(new Blob([response.data]));
const a = document.createElement("a");
a.href = url;
a.download = file_name_regex(attachment.url);
document.body.appendChild(a);
a.click();
window.URL.revokeObjectURL(url);
document.body.removeChild(a);
} catch (error) {
console.error('파일 다운로드 에러: ', error);
}
Copy link
Member

Choose a reason for hiding this comment

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

여기도 then catch

src/components/notice/AttachedBox.tsx Outdated Show resolved Hide resolved
src/components/notice/NoticeListTable.tsx Outdated Show resolved Hide resolved
Copy link
Member

@KANGYONGSU23 KANGYONGSU23 left a comment

Choose a reason for hiding this comment

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

then catch랑 타입 지정만 해주세요

import { useGetNoticeDetailData } from "@/apis/notice";
import AttachedBox from "@/components/notice/AttachedBox";

export default function NoticeDetailPage(props:any) {
Copy link
Member

Choose a reason for hiding this comment

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

any 타입은 최대한 피해야 합니다. ts를 쓰는 이유가 없어져요.

Comment on lines +42 to +49
title: data.title,
content: data.content,
created_at: new Date(data.created_at).toISOString(),
attachments: data.attachments.map((attachment: any) => ({
url: attachment.url,
type: attachment.type
}))
Copy link
Member

Choose a reason for hiding this comment

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

이 부분은 그냥 data를 반환하면 안되나요? object로 한번 더 감싸는 이유가 무엇인가요?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
기능 추가 새로운 기능 요청을 나타냅니다.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants