diff --git a/spot/entrypoints/background.ts b/spot/entrypoints/background.ts index f7531289e..bd7534807 100644 --- a/spot/entrypoints/background.ts +++ b/spot/entrypoints/background.ts @@ -241,13 +241,19 @@ export default defineBackground(() => { if (!pingInt) { pingInt = setInterval(() => { - void pingJWT(url); + void pingJWT(); }, PING_INT) } } }); - async function pingJWT(ingest: string): Promise { + async function pingJWT(): Promise { + const data = await chrome.storage.local.get(["jwtToken", "settings"]) + if (!data.settings) { + return; + } + const { jwtToken, settings } = data; + const ingest = safeApiUrl(settings.ingestPoint); const refreshUrl = safeApiUrl(`${ingest}/api`); if (!jwtToken) { if (pingInt) { @@ -462,7 +468,7 @@ export default defineBackground(() => { } if (!pingInt) { pingInt = setInterval(() => { - void pingJWT(data.settings.ingestPoint); + void pingJWT(); }, PING_INT) } });