Skip to content

Commit

Permalink
refactor(manager): 게시 상태 전환에 대한 메시지를 서버에서 받아오도록 변경
Browse files Browse the repository at this point in the history
refactor(manager): 게시 상태 전환에 대한 메시지를 서버에서 받아오도록 변경
  • Loading branch information
dxwwan authored Mar 8, 2024
2 parents 79200f7 + dbbd4f7 commit 591846f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
7 changes: 7 additions & 0 deletions service-manager/src/apis/dtos/times.dtos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@ export class CouponPublishResponse {
}
}

export class CouponPublishMessageResponse {
message: string;
constructor({ message }: { message: string }) {
this.message = message;
}
}

export class RemoveEventsResponse {
message: string;
constructor({ message }: { message: string }) {
Expand Down
3 changes: 2 additions & 1 deletion service-manager/src/apis/eventSettings.apis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
import {
CouponEvent,
CouponEventDetail,
CouponPublishMessageResponse,
CouponPublishResponse,
RemoveEventsResponse,
SettingTime,
Expand Down Expand Up @@ -108,7 +109,7 @@ export const putPublishBy = async (eventId: string, publish: boolean) => {
if (isErrorResponse(response)) {
throw new Error(response.reason);
}
return new CouponPublishResponse(response);
return new CouponPublishMessageResponse(response);
};

export const deleteEventBy = async (eventId: string) => {
Expand Down
2 changes: 1 addition & 1 deletion service-manager/src/hooks/react-query/useSetting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ export const useSettingPublishMutateBy = (eventId: string) => {
mutationKey: ['publish', eventId],
mutationFn: (publish: boolean) => putPublishBy(eventId, publish),
onSuccess: (response) => {
alert(response.publish ? '게시되었습니다.' : '비게시되었습니다.');
alert(response.message);
queryClient.invalidateQueries({ queryKey: ['couponEvents'] });
navigate('/setting');
},
Expand Down

0 comments on commit 591846f

Please sign in to comment.