Account sync in action
This commit is contained in:
parent
3dd8dd4288
commit
fdee54f921
8 changed files with 118 additions and 32 deletions
|
@ -27,6 +27,7 @@ import Login from "./Login";
|
|||
import Pricing from "./Pricing";
|
||||
import Signup from "./Signup";
|
||||
import Account from "./Account";
|
||||
import accountApi from "../app/AccountApi";
|
||||
|
||||
export const AccountContext = createContext(null);
|
||||
|
||||
|
@ -79,6 +80,20 @@ const Layout = () => {
|
|||
useBackgroundProcesses();
|
||||
useEffect(() => updateTitle(newNotificationsCount), [newNotificationsCount]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!account || !account.sync_topic) {
|
||||
return;
|
||||
}
|
||||
(async () => {
|
||||
const subscription = await subscriptionManager.add(config.base_url, account.sync_topic);
|
||||
if (!subscription.hidden) {
|
||||
await subscriptionManager.update(subscription.id, {
|
||||
internal: true
|
||||
});
|
||||
}
|
||||
})();
|
||||
}, [account]);
|
||||
|
||||
return (
|
||||
<Box sx={{display: 'flex'}}>
|
||||
<ActionBar
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue