Commit a82154de authored by Timothy J. Baek's avatar Timothy J. Baek
Browse files

refac

parent f33ca4c9
......@@ -127,7 +127,7 @@
}
onMount(async () => {
window.addEventListener('message', async (event) => {
const onMessageHandler = async (event) => {
if (event.origin === window.origin) {
// Replace with your iframe's origin
console.log('Message received from iframe:', event.data);
......@@ -160,7 +160,8 @@
}
}
}
});
};
window.addEventListener('message', onMessageHandler);
if (!$chatId) {
chatId.subscribe(async (value) => {
......@@ -173,6 +174,10 @@
await goto('/');
}
}
return () => {
window.removeEventListener('message', onMessageHandler);
};
});
//////////////////////////
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment