forked from jsnbuchanan/crowd-funder-for-time-pwa
don't show non-message to user; fix API server setting; misc doc & task stuff
This commit is contained in:
@@ -466,6 +466,7 @@ async function getNotificationCount() {
|
||||
if ("secret" in self) {
|
||||
secret = self.secret;
|
||||
const secretUint8Array = self.decodeBase64(secret);
|
||||
// 1 is our master settings ID; see MASTER_SETTINGS_KEY
|
||||
const settings = await getSettingById(1);
|
||||
let lastNotifiedClaimId = null;
|
||||
if ("lastNotifiedClaimId" in settings) {
|
||||
@@ -496,7 +497,7 @@ async function getNotificationCount() {
|
||||
headers["Authorization"] = "Bearer " + (await accessToken(identifier));
|
||||
|
||||
let response = await fetch(
|
||||
"https://test-api.endorser.ch/api/v2/report/claims",
|
||||
settings["apiServer"] + "/api/v2/report/claims",
|
||||
{
|
||||
method: "GET",
|
||||
headers: headers,
|
||||
@@ -513,15 +514,13 @@ async function getNotificationCount() {
|
||||
}
|
||||
newClaims++;
|
||||
}
|
||||
if (newClaims === 0) {
|
||||
result = "You have no new claims today.";
|
||||
} else {
|
||||
result = `${newClaims} have been shared with you`;
|
||||
if (newClaims > 0) {
|
||||
result = `There are ${newClaims} new activities on TimeSafari`;
|
||||
}
|
||||
const most_recent_notified = claims[0]["id"];
|
||||
await setMostRecentNotified(most_recent_notified);
|
||||
} else {
|
||||
console.error(response.status);
|
||||
console.error("The service worker got a bad response status when fetching claims:", response.status, response);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user