diff options
author | crupest <crupest@outlook.com> | 2023-08-31 02:19:01 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2023-08-31 02:19:01 +0800 |
commit | 4a6d8c606fab0215065ce65d2f105fafd8db7169 (patch) | |
tree | 9b4231c70123b6801ab341f944d0f29ed95af6c1 /FrontEnd/src/components/alert/AlertHost.tsx | |
parent | fb64a8f3d4a7dd4035f50ccf2601ae0a683bd1b8 (diff) | |
download | timeline-4a6d8c606fab0215065ce65d2f105fafd8db7169.tar.gz timeline-4a6d8c606fab0215065ce65d2f105fafd8db7169.tar.bz2 timeline-4a6d8c606fab0215065ce65d2f105fafd8db7169.zip |
...
Diffstat (limited to 'FrontEnd/src/components/alert/AlertHost.tsx')
-rw-r--r-- | FrontEnd/src/components/alert/AlertHost.tsx | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/FrontEnd/src/components/alert/AlertHost.tsx b/FrontEnd/src/components/alert/AlertHost.tsx index 23f62472..59f8f27c 100644 --- a/FrontEnd/src/components/alert/AlertHost.tsx +++ b/FrontEnd/src/components/alert/AlertHost.tsx @@ -46,11 +46,14 @@ export default function AlertHost() { const [alerts, setAlerts] = useState<AlertInfoWithId[]>([]); useEffect(() => { - alertService.registerListener(setAlerts); + const listener = (alerts: AlertInfoWithId[]) => { + setAlerts(alerts); + }; + + alertService.registerListener(listener); return () => { - alertService.unregisterListener(setAlerts); - alert; + alertService.unregisterListener(listener); }; }, []); |