Browser based potokens
This commit is contained in:
1 parent
5e798f19de
commit
63f9ac693a
27 files changed
+722
-499
No files matched your search
@@ -24,8 +24,19 @@
|
||||
import BookmarksScreen from "lib/Screens/BookmarksScreen.svelte";
|
||||
import RemoteControlScreen from "lib/Screens/RemoteControlScreen.svelte";
|
||||
import { fetchLocale } from "lib/Api/Locale";
|
||||
import { ensureDevicePoTokenWithToast } from "lib/ensureDevicePoToken";
|
||||
import Toast from "lib/Toast.svelte";
|
||||
|
||||
// Mint on load, then refresh hourly while the page is open.
|
||||
const POTOKEN_REFRESH_INTERVAL_MS = 60 * 60 * 1000;
|
||||
|
||||
onMount(() => {
|
||||
ensureDevicePoTokenWithToast();
|
||||
const poTokenRefreshInterval = setInterval(
|
||||
ensureDevicePoTokenWithToast,
|
||||
POTOKEN_REFRESH_INTERVAL_MS,
|
||||
);
|
||||
|
||||
PlayletApi.getState().then((value) => {
|
||||
playletStateStore.set(value);
|
||||
fetchLocale(value.device?.current_locale);
|
||||
@@ -62,6 +73,8 @@
|
||||
PlayletApi.getBookmarkFeeds().then((value) => {
|
||||
bookmarksStore.set(value);
|
||||
});
|
||||
|
||||
return () => clearInterval(poTokenRefreshInterval);
|
||||
});
|
||||
|
||||
let currentScreen: AppState["screen"];
|
||||
@@ -93,3 +106,5 @@
|
||||
</div>
|
||||
<BottomNavigation />
|
||||
</main>
|
||||
|
||||
<Toast />
|
||||
Reference in new issue
Block a user