Skip to content

Commit

Permalink
R2-2619 - Fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
aespinoza-quoin committed Sep 22, 2023
1 parent b4dfb95 commit 813c125
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions app/javascript/libs/service-worker-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import getToken from "../middleware/utils/get-token";
import DB, { DB_STORES } from "../db";

const SERVICE_WORKER_PATH = `${window.location.origin}/worker.js`;
const MAX_ATTEMPS = 3;
let attemps = 1;
const MAX_ATTEMPTS = 3;
let attempts = 1;

async function getServiceWorker() {
return navigator.serviceWorker.ready;
Expand Down Expand Up @@ -67,18 +67,18 @@ async function sendSubscriptionStatusToServer(isSubscribing = true, data = {}) {
}

if (isSubscribing && response.status === 404) {
if (attemps % MAX_ATTEMPS !== 0) {
if (attempts % MAX_ATTEMPTS !== 0) {
postMessage({
type: POST_MESSAGES.SUBSCRIBE_NOTIFICATIONS
});
}

if (attemps % MAX_ATTEMPS === 0) {
if (attempts % MAX_ATTEMPTS === 0) {
postMessage({
type: POST_MESSAGES.ATTEMPTS_SUBSCRIPTION_FAILED
});
}
attemps += 1;
attempts += 1;
}
}

Expand Down

0 comments on commit 813c125

Please sign in to comment.