1
0
Fork 0
mirror of https://github.com/binwiederhier/ntfy.git synced 2025-06-02 19:35:53 +02:00

Automatic account sync with react

This commit is contained in:
binwiederhier 2023-01-02 22:21:11 -05:00
parent d666cab77a
commit bb583eaa72
5 changed files with 81 additions and 57 deletions
web/src/components

View file

@ -96,3 +96,15 @@ export const useBackgroundProcesses = () => {
accountApi.startWorker();
}, []);
}
export const useAccountListener = (setAccount) => {
useEffect(() => {
accountApi.registerListener(setAccount);
(async () => {
await accountApi.sync();
})();
return () => {
accountApi.registerListener();
}
}, []);
}