Skip to content

Commit

Permalink
feat(bottle): handle bottle refuse
Browse files Browse the repository at this point in the history
  • Loading branch information
stakbucks committed Oct 5, 2024
1 parent 2faad25 commit c1ee16a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
18 changes: 14 additions & 4 deletions apps/bottle/src/app/bottle/[...slug]/ActionButtons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export function ActionButtons({ type, id }: Props) {
const { send } = useAppBridge();

const { mutateAsync: accept } = useAcceptBottleMutation(type, id);
const { mutate: refuse } = useRefuseBottleMutation(id);
const { mutateAsync: refuse } = useRefuseBottleMutation(id);

const handleRightClick =
type === 'recommendation'
Expand All @@ -33,14 +33,24 @@ export function ActionButtons({ type, id }: Props) {
/>
));
}
: () => {
accept(null);
: async () => {
await accept(null);
send({ type: AppBridgeMessageType.BOTTLE_ACCEPT });
};

return (
<FixedBottomCTAButton
variant="two"
left={<CTAButton.Left onClick={() => refuse()}>떠내려 보내기</CTAButton.Left>}
left={
<CTAButton.Left
onClick={async () => {
await refuse();
send({ type: AppBridgeMessageType.WEB_VIEW_CLOSE });
}}
>
떠내려 보내기
</CTAButton.Left>
}
right={
<CTAButton.Right onClick={handleRightClick}>
{type !== 'sent' ? '호감 표현하기' : '문답 시작하기'}
Expand Down
1 change: 0 additions & 1 deletion apps/bottle/src/store/mutation/useAcceptBottleMutation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ export function useAcceptBottleMutation<T extends BottleType>(type: T, id: Bottl
send({ type: AppBridgeMessageType.TOAST_OPEN, payload: { message: '호감을 보냈어요' } });
return;
}
send({ type: AppBridgeMessageType.BOTTLE_ACCEPT });
await logAcceptBottleAction();
},
});
Expand Down
1 change: 0 additions & 1 deletion apps/bottle/src/store/mutation/useRefuseBottleMutation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ export function useRefuseBottleMutation(id: Bottle['id']) {
queryClient.invalidateQueries({ queryKey: bottlesQueryOptions(tokens).queryKey });
send({ type: AppBridgeMessageType.TOAST_OPEN, payload: { message: '보틀을 떠내려 보냈어요' } });
await logRefuseBottleAction();
router.back();
},
});
}

0 comments on commit c1ee16a

Please sign in to comment.