From 18402401e35666f5451c0544bbbd2a2d410d2799 Mon Sep 17 00:00:00 2001 From: Brendan Chen Date: Mon, 3 Feb 2025 21:57:42 -0800 Subject: [PATCH] rename token variable for clarity --- src/services/NotificationService.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/services/NotificationService.ts b/src/services/NotificationService.ts index a223e89..ffa0937 100644 --- a/src/services/NotificationService.ts +++ b/src/services/NotificationService.ts @@ -12,7 +12,7 @@ interface ScheduledNotificationData { } export class NotificationService { - private token: string | undefined = undefined; + private apnsToken: string | undefined = undefined; private _lastRefreshedTimeMs: number | undefined = undefined; get lastRefreshedTimeMs() { @@ -53,7 +53,7 @@ export class NotificationService { "iat": now, }; - this.token = jwt.sign(claimsPayload, privateKey, { + this.apnsToken = jwt.sign(claimsPayload, privateKey, { algorithm: "ES256", header: tokenHeader }); @@ -66,6 +66,8 @@ export class NotificationService { } private async sendEtaNotificationImmediately({ deviceId, shuttleId, stopId }: ScheduledNotificationData): Promise { + this.reloadAPNsTokenIfTimePassed(); + // Construct the fetch request // Send the fetch request