mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-03-11 21:27:05 +00:00
fix(App): update ctx api actions hook logic
This commit is contained in:
parent
43f3481632
commit
2beaffc9ab
1 changed files with 22 additions and 21 deletions
|
|
@ -91,28 +91,29 @@ const App = () => {
|
|||
}, []);
|
||||
React.useEffect(() => {
|
||||
const onWindowFocus = () => {
|
||||
if (services.core.active) {
|
||||
services.core.transport.dispatch({
|
||||
action: 'Ctx',
|
||||
args: {
|
||||
action: 'PullAddonsFromAPI'
|
||||
}
|
||||
});
|
||||
services.core.transport.dispatch({
|
||||
action: 'Ctx',
|
||||
args: {
|
||||
action: 'PullUserFromAPI'
|
||||
}
|
||||
});
|
||||
services.core.transport.dispatch({
|
||||
action: 'Ctx',
|
||||
args: {
|
||||
action: 'SyncLibraryWithAPI'
|
||||
}
|
||||
});
|
||||
}
|
||||
services.core.transport.dispatch({
|
||||
action: 'Ctx',
|
||||
args: {
|
||||
action: 'PullAddonsFromAPI'
|
||||
}
|
||||
});
|
||||
services.core.transport.dispatch({
|
||||
action: 'Ctx',
|
||||
args: {
|
||||
action: 'PullUserFromAPI'
|
||||
}
|
||||
});
|
||||
services.core.transport.dispatch({
|
||||
action: 'Ctx',
|
||||
args: {
|
||||
action: 'SyncLibraryWithAPI'
|
||||
}
|
||||
});
|
||||
};
|
||||
window.addEventListener('focus', onWindowFocus);
|
||||
if (services.core.active) {
|
||||
onWindowFocus();
|
||||
window.addEventListener('focus', onWindowFocus);
|
||||
}
|
||||
return () => window.removeEventListener('focus', onWindowFocus);
|
||||
}, [initialized]);
|
||||
return (
|
||||
|
|
|
|||
Loading…
Reference in a new issue