Skip to content

Commit

Permalink
Merge pull request #83 from bssm-portfolio/hotfix/put-error
Browse files Browse the repository at this point in the history
포트폴리오 수정 로직 관련 이슈 해결
  • Loading branch information
J1min authored Mar 16, 2023
2 parents 247bf27 + f1b5adc commit 59e618c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
20 changes: 16 additions & 4 deletions components/portfolio/edit/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export default function PortfolioEdit({ portfolioId }: PortfolioEditProps) {

const onValid: SubmitHandler<PortfolioForm> = async (data) => {
const getPortfolioType = (): PortfolioType => {
if (data.portfolioUrl.length > 0 && videoFileUid) {
if (data.portfolioUrl.length > 0 && (videoFileUid || editVideoFile)) {
return "ALL";
}
if (videoFileUid) {
Expand All @@ -56,7 +56,7 @@ export default function PortfolioEdit({ portfolioId }: PortfolioEditProps) {
if (editVideoFile)
return getFileUidByFileUpload(editVideoFile, openToast);
if (videoFileUid && !editVideoFile) return videoFileUid;
return undefined;
return "299ae74e-dbda-4def-a3b0-0939aadd997c.mp4";
};

const getThumbnailFileUid = () => {
Expand All @@ -72,8 +72,20 @@ export default function PortfolioEdit({ portfolioId }: PortfolioEditProps) {
portfolioType: getPortfolioType(),
skillList: selectedSkills,
contributorIdList: selectedMembers.map((member) => member.memberId),
videoFileUid: await getVideoFileUid(),
thumbnailFileUid: await getThumbnailFileUid(),
videoFileUid: (await getVideoFileUid()) || undefined,
thumbnailFileUid: (await getThumbnailFileUid()) || "ㅇㅇㅇ",
video: undefined,
thumbnail: undefined,
writer: undefined,
scope: undefined,
contributorList: undefined,
bookmarks: undefined,
bookmarkYn: undefined,
followYn: undefined,
views: undefined,
comments: undefined,
recommendStatus: undefined,
createdDate: undefined,
})
.then(() => {
openToast("수정이 완료되었습니다.");
Expand Down
4 changes: 2 additions & 2 deletions utils/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ export const getFileUidByFileUpload = async (
) => {
return httpClient.file
.upload(getFormData(file))
.then(({ data }) => {
.then((r) => {
openToast("파일 업로드에 성공하였습니다.");
return data.fileUid;
return r.data.fileUid;
})
.catch(() =>
openToast("파일 업로드에 실패하였습니다.", { type: "danger" }),
Expand Down

0 comments on commit 59e618c

Please sign in to comment.