RED-3800 cache cleanup
This commit is contained in:
parent
6c9d9ee234
commit
30045f947a
@ -3,7 +3,7 @@ import { HttpClient } from '@angular/common/http';
|
||||
import { Title } from '@angular/platform-browser';
|
||||
import packageInfo from '../../../../../package.json';
|
||||
import envConfig from '../../assets/config/config.json';
|
||||
import { CacheApiService, wipeCaches } from '@red/cache';
|
||||
import { CacheApiService, wipeAllCaches, wipeCaches } from '@red/cache';
|
||||
import { Observable } from 'rxjs';
|
||||
import { tap } from 'rxjs/operators';
|
||||
import { AppConfig } from '@red/domain';
|
||||
@ -47,7 +47,7 @@ export class ConfigService {
|
||||
console.log('[REDACTION] Last app version: ', lastVersion, ' current version ', version);
|
||||
if (lastVersion !== version) {
|
||||
console.warn('[REDACTION] Version-mismatch - wiping caches!');
|
||||
await wipeCaches();
|
||||
await wipeAllCaches();
|
||||
}
|
||||
await this._cacheApiService.cacheValue('FRONTEND_APP_VERSION', version);
|
||||
});
|
||||
|
||||
@ -19,6 +19,13 @@ export const DYNAMIC_CACHES = [
|
||||
},
|
||||
];
|
||||
|
||||
export async function wipeAllCaches() {
|
||||
const keys = await caches.keys();
|
||||
for (const cache of keys) {
|
||||
await caches.delete(cache);
|
||||
}
|
||||
}
|
||||
|
||||
export async function wipeCaches(logoutDependant: boolean = false) {
|
||||
await caches.delete(APP_LEVEL_CACHE);
|
||||
for (const cache of DYNAMIC_CACHES) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user