2020-03-09 13:42:32 +05:30
|
|
|
import Cookies from 'js-cookie';
|
|
|
|
|
|
|
|
const handleOnDismiss = ({ currentTarget }) => {
|
|
|
|
currentTarget.removeEventListener('click', handleOnDismiss);
|
|
|
|
const {
|
|
|
|
dataset: { id },
|
|
|
|
} = currentTarget;
|
|
|
|
|
2020-04-08 14:13:33 +05:30
|
|
|
Cookies.set(`hide_broadcast_message_${id}`, true);
|
2020-03-09 13:42:32 +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')
|
|
|
|
.forEach(dismissButton => dismissButton.addEventListener('click', handleOnDismiss));
|
2020-03-09 13:42:32 +05:30
|
|
|
};
|