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:
parent
d666cab77a
commit
bb583eaa72
5 changed files with 81 additions and 57 deletions
web/src/components
|
@ -96,3 +96,15 @@ export const useBackgroundProcesses = () => {
|
|||
accountApi.startWorker();
|
||||
}, []);
|
||||
}
|
||||
|
||||
export const useAccountListener = (setAccount) => {
|
||||
useEffect(() => {
|
||||
accountApi.registerListener(setAccount);
|
||||
(async () => {
|
||||
await accountApi.sync();
|
||||
})();
|
||||
return () => {
|
||||
accountApi.registerListener();
|
||||
}
|
||||
}, []);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue