({
organizationId,
regionId,
}: {
organizationId?: string;
regionId: string;
})
| 27 | } |
| 28 | |
| 29 | export function getCache({ |
| 30 | organizationId, |
| 31 | regionId, |
| 32 | }: { |
| 33 | organizationId?: string; |
| 34 | regionId: string; |
| 35 | }): CommandCache { |
| 36 | const cacheString = storageAvailable("localStorage") |
| 37 | ? window.localStorage.getItem(buildCacheKey({ organizationId, regionId })) |
| 38 | : null; |
| 39 | if (cacheString === null) { |
| 40 | // The version number may only be incremented if a migration exists. |
| 41 | return { version: 1, commands: [] }; |
| 42 | } |
| 43 | const cache: CommandCache = JSON.parse(cacheString); |
| 44 | // TODO: when we have a version that is not v1, migrations should be |
| 45 | // performed here. |
| 46 | return cache; |
| 47 | } |
| 48 | |
| 49 | export function appendToCache({ |
| 50 | organizationId, |
no test coverage detected