From ccca40011bab5feaea134777f487eca2679cff8e Mon Sep 17 00:00:00 2001 From: nick-delirium Date: Wed, 4 Sep 2024 12:25:59 +0200 Subject: [PATCH] change spot refresh url getter --- spot/entrypoints/background.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) 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) } });