({
organizationId,
regionId,
command,
}: {
organizationId?: string;
regionId: string;
command: string;
})
| 47 | } |
| 48 | |
| 49 | export function appendToCache({ |
| 50 | organizationId, |
| 51 | regionId, |
| 52 | command, |
| 53 | }: { |
| 54 | organizationId?: string; |
| 55 | regionId: string; |
| 56 | command: string; |
| 57 | }) { |
| 58 | if (storageAvailable("localStorage")) { |
| 59 | const cache = getCache({ organizationId, regionId }); |
| 60 | cache.commands.push(command); |
| 61 | if (cache.commands.length > MAX_CACHED_COMMANDS) { |
| 62 | cache.commands.splice(0, cache.commands.length - MAX_CACHED_COMMANDS); |
| 63 | } |
| 64 | window.localStorage.setItem( |
| 65 | buildCacheKey({ organizationId, regionId }), |
| 66 | JSON.stringify(cache), |
| 67 | ); |
| 68 | } |
| 69 | } |
no test coverage detected