mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-05-04 13:59:03 +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(() => {
|
React.useEffect(() => {
|
||||||
const onWindowFocus = () => {
|
const onWindowFocus = () => {
|
||||||
if (services.core.active) {
|
services.core.transport.dispatch({
|
||||||
services.core.transport.dispatch({
|
action: 'Ctx',
|
||||||
action: 'Ctx',
|
args: {
|
||||||
args: {
|
action: 'PullAddonsFromAPI'
|
||||||
action: 'PullAddonsFromAPI'
|
}
|
||||||
}
|
});
|
||||||
});
|
services.core.transport.dispatch({
|
||||||
services.core.transport.dispatch({
|
action: 'Ctx',
|
||||||
action: 'Ctx',
|
args: {
|
||||||
args: {
|
action: 'PullUserFromAPI'
|
||||||
action: 'PullUserFromAPI'
|
}
|
||||||
}
|
});
|
||||||
});
|
services.core.transport.dispatch({
|
||||||
services.core.transport.dispatch({
|
action: 'Ctx',
|
||||||
action: 'Ctx',
|
args: {
|
||||||
args: {
|
action: 'SyncLibraryWithAPI'
|
||||||
action: 'SyncLibraryWithAPI'
|
}
|
||||||
}
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
window.addEventListener('focus', onWindowFocus);
|
if (services.core.active) {
|
||||||
|
onWindowFocus();
|
||||||
|
window.addEventListener('focus', onWindowFocus);
|
||||||
|
}
|
||||||
return () => window.removeEventListener('focus', onWindowFocus);
|
return () => window.removeEventListener('focus', onWindowFocus);
|
||||||
}, [initialized]);
|
}, [initialized]);
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue