Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feat] 티클 종료 status 변경 시점 변경 #384

Merged
merged 2 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions apps/web/src/components/live/ControlBar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
} else {
startScreenStream();
}
} catch (_) {

Check warning on line 64 in apps/web/src/components/live/ControlBar/index.tsx

View workflow job for this annotation

GitHub Actions / check

'_' is defined but never used
closeStream('screen');
}
};
Expand Down Expand Up @@ -106,20 +106,25 @@
};

useEffect(() => {
const handleBeforeUnload = (e: Event) => {
if (isOwner) {
const blob = new Blob([], {
type: 'application/json',
});
const handleBeforeUnload = (e: BeforeUnloadEvent) => {
e.preventDefault();
};

const handleUnload = () => {
if (isOwner) {
const blob = new Blob([], { type: 'application/json' });
navigator.sendBeacon(`${ENV.API_URL}/dashboard/${ticleId}/end`, blob);
}
e.preventDefault();
};

window.addEventListener('beforeunload', handleBeforeUnload);
return () => window.removeEventListener('beforeunload', handleBeforeUnload);
window.addEventListener('unload', handleUnload);

return () => {
window.removeEventListener('beforeunload', handleBeforeUnload);
window.removeEventListener('unload', handleUnload);
};
}, []);

Check warning on line 127 in apps/web/src/components/live/ControlBar/index.tsx

View workflow job for this annotation

GitHub Actions / check

React Hook useEffect has missing dependencies: 'isOwner' and 'ticleId'. Either include them or remove the dependency array

return (
<>
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/hooks/mediasoup/useMediasoup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,11 @@ const useMediasoup = () => {
clearMediasoup();
};

window.addEventListener('beforeunload', clearAll);
window.addEventListener('unload', clearAll);

return () => {
clearAll();
window.removeEventListener('beforeunload', clearAll);
window.removeEventListener('unload', clearAll);
};
}, []);
};
Expand Down
Loading