2022-04-04 11:22:00 +05:30
|
|
|
import { setCookie } from '~/lib/utils/common_utils';
|
2020-03-13 15:44:24 +05:30
|
|
|
|
|
|
|
const handleOnDismiss = ({ currentTarget }) => {
|
|
|
|
currentTarget.removeEventListener('click', handleOnDismiss);
|
|
|
|
const {
|
2020-05-24 23:13:21 +05:30
|
|
|
dataset: { id, expireDate },
|
2020-03-13 15:44:24 +05:30
|
|
|
} = currentTarget;
|
|
|
|
|
2022-04-04 11:22:00 +05:30
|
|
|
setCookie(`hide_broadcast_message_${id}`, true, { expires: new Date(expireDate) });
|
2020-03-13 15:44:24 +05:30
|
|
|
|
|
|
|
const notification = document.querySelector(`.js-broadcast-notification-${id}`);
|
|
|
|
notification.parentNode.removeChild(notification);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default () => {
|
2020-04-08 14:13:33 +05:30
|
|
|
document
|
|
|
|
.querySelectorAll('.js-dismiss-current-broadcast-notification')
|
2021-03-08 18:12:59 +05:30
|
|
|
.forEach((dismissButton) => dismissButton.addEventListener('click', handleOnDismiss));
|
2020-03-13 15:44:24 +05:30
|
|
|
};
|