feat (restful): Add /api/utils/refresh

The API call does the following:
- Fetch GitHub avatar and update artifact store url
- Revoke all cached resources
This commit is contained in:
Peng-YM
2022-07-11 23:06:40 +08:00
parent 6881148021
commit 2c4e47166d
8 changed files with 37 additions and 14 deletions

View File

@@ -25,6 +25,14 @@ class ResourceCache {
if (clear) this._persist();
}
revokeAll() {
Object.keys(this.resourceCache).forEach((id) => {
$.delete(`#${id}`);
});
this.resourceCache = {};
this._persist();
}
_persist() {
$.write(JSON.stringify(this.resourceCache), RESOURCE_CACHE_KEY);
}