Skip to content
Merged
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
39 changes: 21 additions & 18 deletions src/components/Gnb/Notification.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,25 +146,28 @@ export default function Notification({ closeModal }: { closeModal: () => void })
className={`max-h-[300px] overflow-y-auto ${notificationData.length >= 4 ? "h-[300px]" : ""}`}
>
<ul>
{notificationData.map((notification, index) => (
<div key={notification.id}>
<li
onClick={() => handleRead(notification.id)}
className={`cursor-pointer pt-4 ${notification.isRead ? "bg-[#f1f1f1]" : "bg-color-gray-50"}`}
>
<p className="px-5 text-lg">
{getNotificationMessage(notification.event, notification.payload)}
</p>
<p className="px-5 pb-4 text-md text-color-gray-300">
{formatRelativeTime(notification.createdAt)}
</p>
{notificationData
.slice()
.reverse()
.map((notification, index) => (
<div key={notification.id}>
<li
onClick={() => handleRead(notification.id)}
className={`cursor-pointer pt-4 ${notification.isRead ? "bg-[#f1f1f1]" : "bg-color-gray-50"}`}
>
<p className="px-5 text-lg">
{getNotificationMessage(notification.event, notification.payload)}
</p>
<p className="px-5 pb-4 text-md text-color-gray-300">
{formatRelativeTime(notification.createdAt)}
</p>

{index < notificationData.length - 1 && (
<div className="h-0.5 bg-color-line-100"></div>
)}
</li>
</div>
))}
{index < notificationData.length - 1 && (
<div className="h-0.5 bg-color-line-100"></div>
)}
</li>
</div>
))}
</ul>
</div>
)}
Expand Down
4 changes: 1 addition & 3 deletions src/features/DetailMaker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,7 @@ export default function RequestDetailDreamer() {
setIsRequestSuccessModalOpen(true);
},
onError: (error: any) => {
if (error.message === "이미 지정 견적을 요청하셨습니다!") {
alert(error.message);
}
alert(error.message);
},
});

Expand Down
5 changes: 4 additions & 1 deletion src/services/planService.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { BAD_REQUEST, CONFLICT } from "@/utils/errorStatus";
import { api } from "./api";
import { ServiceArea } from "@/utils/formatRegion";

Expand Down Expand Up @@ -128,8 +129,10 @@ const planService = {
const response = await api.post(`/plans/${planId}/assign`, { assigneeId });
return response;
} catch (error: any) {
if (error.response && error.response.status === 409) {
if (error.response && error.response.status === CONFLICT) {
throw new Error("이미 지정 견적을 요청하셨습니다!");
} else if (error.response && error.response.status === BAD_REQUEST) {
throw new Error("Maker가 서비스하는 지역이 아닙니다.");
}
}
},
Expand Down