diff --git a/src/lib/cards/SpecialCards/UpdatedBlentos/index.ts b/src/lib/cards/SpecialCards/UpdatedBlentos/index.ts index 9d6ebb1..783cfb0 100644 --- a/src/lib/cards/SpecialCards/UpdatedBlentos/index.ts +++ b/src/lib/cards/SpecialCards/UpdatedBlentos/index.ts @@ -6,13 +6,13 @@ import UpdatedBlentosCard from './UpdatedBlentosCard.svelte'; export const UpdatedBlentosCardDefitition = { type: 'updatedBlentos', contentComponent: UpdatedBlentosCard, - loadData: async (items, { platform }) => { + loadData: async (items, { cache }) => { try { const response = await fetch( 'https://ufos-api.microcosm.blue/records?collection=app.blento.card' ); const recentRecords = await response.json(); - const existingUsers = await platform?.env?.USER_DATA_CACHE?.get('updatedBlentos'); + const existingUsers = await cache?.get('updatedBlentos'); const existingUsersArray: ProfileViewDetailed[] = existingUsers ? JSON.parse(existingUsers) : []; @@ -34,8 +34,8 @@ export const UpdatedBlentosCardDefitition = { const result = [...(await Promise.all(profiles)), ...existingUsersArray]; - if (platform?.env?.USER_DATA_CACHE) { - await platform?.env?.USER_DATA_CACHE.put('updatedBlentos', JSON.stringify(result)); + if (cache) { + await cache?.put('updatedBlentos', JSON.stringify(result)); } return JSON.parse(JSON.stringify(result)); } catch (error) { diff --git a/src/lib/cards/types.ts b/src/lib/cards/types.ts index ac36adb..af9a469 100644 --- a/src/lib/cards/types.ts +++ b/src/lib/cards/types.ts @@ -1,5 +1,5 @@ import type { Component } from 'svelte'; -import type { Item } from '$lib/types'; +import type { Item, UserCache } from '$lib/types'; export type CreationModalComponentProps = { item: Item; @@ -41,7 +41,7 @@ export type CardDefinition = { // optionally load some extra data loadData?: ( items: Item[], - { did, handle, platform }: { did: string; handle: string; platform?: App.Platform } + { did, handle, cache }: { did: string; handle: string; cache?: UserCache } ) => Promise; // show color selection popup