Skip to content

Commit

Permalink
fix: type 불일치 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
wildcatco committed Sep 1, 2023
1 parent d5e2e7b commit a938b4f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/features/comments/queries/useGetComments.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export default function useGetComments(postId: number) {
profileImage: user.profileImageUrl,
nickname: user.nickname,
birthDate: user.birthDate,
worryChoice: user.worryChoice
choice: user.worryChoice
? {
id: user.worryChoice.id,
label: user.worryChoice.label,
Expand Down
6 changes: 3 additions & 3 deletions src/features/posts/types/post-form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ export interface PostFormData {
content: string;
images: {
id?: number;
file: File;
file: File | null;
url: string;
}[];
categoryId?: number;
deadline?: number;
voteOptions: {
label: string;
image: {
file: File;
url: string;
file: File | null;
url: string | null;
} | null;
}[];
}
6 changes: 5 additions & 1 deletion src/pages/edit-post/EditPostPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,16 @@ export default function EditPostPage() {
.map((file) => ({
id: file.id,
url: file.url,
file: null,
}))
.sort((a, b) => a.id - b.id),
categoryId: post.worryCategory.id,
voteOptions: post.worryChoices.map((choice) => ({
label: choice.label,
image: choice.url,
image: {
url: choice.url,
file: null,
},
})),
deadline: getDeadline(post.expirationTime, post.createdAt),
}}
Expand Down
4 changes: 2 additions & 2 deletions src/pages/write/WritePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ export default function WritePage() {

setUploadLoading(true);
const uploadPromises = [
...images.map((image) => uploadImage(image.file)),
...images.map((image) => image.file && uploadImage(image.file)),
...voteOptions.map(
(option) => option.image && uploadImage(option.image.file),
(option) => option.image?.file && uploadImage(option.image.file),
),
];
const result = (await Promise.all(uploadPromises)).filter(
Expand Down

0 comments on commit a938b4f

Please sign in to comment.