Skip to content

Commit

Permalink
fix(mi): Close Web App tab after Take Now (M2-7159) (#500)
Browse files Browse the repository at this point in the history
* M2-7159: add sent message to admin to close the current tab

* Update src/features/TakeNow/ui/TakeNowSuccessModal.tsx

Co-authored-by: Farmer Paul <[email protected]>

---------

Co-authored-by: Farmer Paul <[email protected]>
  • Loading branch information
ionyRojas and farmerpaul authored Jul 5, 2024
1 parent ab107b0 commit ada5da3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/features/TakeNow/ui/TakeNowSuccessModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,12 @@ export const TakeNowSuccessModal = ({
{ send_immediately: true },
() => {
onClose?.();
window.close();
const targetWindow = window.opener as Window;

if (targetWindow) {
// Send message to the opening tab in the Admin App to close this tab (see its TakeNowModal component).
targetWindow.postMessage('close-me', import.meta.env.VITE_ADMIN_PANEL_HOST);
}
},
);
};
Expand Down

0 comments on commit ada5da3

Please sign in to comment.