Skip to content

Commit

Permalink
Maryia/TrackJS_Avoiding_Pushwoosh_Failed_to_fetch_error (#4894)
Browse files Browse the repository at this point in the history
* Maryia/Checking network status before initializing Pushwoosh

* Maryia/refactoring

Co-authored-by: Matin shafiei <matin@binary.com>
  • Loading branch information
maryia-deriv-archive and matin-deriv committed Mar 8, 2022
1 parent 711a6f4 commit 1d99f03
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/core/src/Stores/pushwoosh-store.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { action } from 'mobx';
import { action, when } from 'mobx';
import { Pushwoosh } from 'web-push-notifications';
import { getAppId, urlForCurrentDomain } from '@deriv/shared';
import { getLanguage } from '@deriv/translations';
Expand All @@ -18,8 +18,9 @@ export default class PushwooshStore extends BaseStore {
* Pushes initialize event to pushwoosh
*/
@action.bound
init = () => {
init = async () => {
if (!this.is_applicable && this.has_initialized) return;
await when(() => this.root_store.common.is_network_online);

this.push_woosh.push([
'init',
Expand Down

0 comments on commit 1d99f03

Please sign in to comment.