Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mosu-admin/src/api/inquiry/inquiry-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export interface InquiryResponseBody {
title: string;
content: string;
author: string;
status: "PENDING" | "COMPLETED";
status: "미응답" | "완료";
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Consider defining the status values as constants to improve maintainability. This avoids "magic strings" and makes the code more robust if the API response values change in the future.

createdAt: string;
}

Expand Down
1 change: 1 addition & 0 deletions mosu-admin/src/api/inquiry/inquiry-update-reply.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export const useUpdateInquiryReply = (postId: number) => {
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: inquiryQueryKeys.detail(postId) });
queryClient.invalidateQueries({ queryKey: inquiryQueryKeys.update(postId) });
queryClient.invalidateQueries({ queryKey: inquiryQueryKeys.list() });
},
onError: (error) => {
console.error(error);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,14 @@ export function InquiryPanel() {
const columns = new ColumnBuilder<InquiryItem>()
.custom("status", "상태", (row) => (
<Badge
variant={row.status === "COMPLETED" ? "default" : "secondary"}
variant={row.status === "완료" ? "default" : "secondary"}
className={
row.status === "COMPLETED"
row.status === "완료"
? "border-blue-400 bg-transparent text-blue-400"
: "border-gray-400 bg-transparent text-gray-400"
}
>
{row.status === "COMPLETED" ? "완료" : "미응답"}
{row.status === "완료" ? "완료" : "미응답"}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The ternary expression is redundant. Since row.status is guaranteed by its type to be either "완료" or "미응답", you can simplify this to display row.status directly.

{row.status}

</Badge>
))
.text("id", "게시글번호")
Expand Down
4 changes: 2 additions & 2 deletions mosu-admin/src/hooks/inquiry/useInquiryFilters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ export function useInquiryFilters(inquiries: InquiryResponseBody[]) {
const filteredInquiries = useMemo(() => {
return inquiries.filter((inquiry) => {
if (selectedFilters.all) return true;
if (selectedFilters.answered && inquiry.status === "COMPLETED") return true;
if (selectedFilters.unanswered && inquiry.status === "PENDING") return true;
if (selectedFilters.answered && inquiry.status === "완료") return true;
if (selectedFilters.unanswered && inquiry.status === "미응답") return true;
Comment on lines +14 to +15
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Consider using constants for the status values ("완료", "미응답") to improve maintainability and avoid "magic strings".

return false;
});
}, [inquiries, selectedFilters]);
Expand Down