Add statistics pages - fix link caching issue

This commit is contained in:
Samuel
2020-10-07 13:53:20 +02:00
parent b6ff9369e4
commit d843230158

View File

@@ -88,28 +88,32 @@ export class MenuEffects {
private resolveSubstitutions(object, params) { private resolveSubstitutions(object, params) {
let resolved;
if (typeof object === 'string') { if (typeof object === 'string') {
resolved = object;
let match: RegExpMatchArray; let match: RegExpMatchArray;
do { do {
match = object.match(/:(\w+)/); match = resolved.match(/:(\w+)/);
if (match) { if (match) {
const substitute = params[match[1]]; const substitute = params[match[1]];
if (hasValue(substitute)) { if (hasValue(substitute)) {
object = object.replace(match[0], `${substitute}`); resolved = resolved.replace(match[0], `${substitute}`);
} }
} }
} while (match); } while (match);
} else if (Array.isArray(object)) { } else if (Array.isArray(object)) {
resolved = [];
object.forEach((entry, index) => { object.forEach((entry, index) => {
object[index] = this.resolveSubstitutions(object[index], params); resolved[index] = this.resolveSubstitutions(object[index], params);
});
} else if (typeof object === 'object') {
resolved = {};
Object.keys(object).forEach((key) => {
resolved[key] = this.resolveSubstitutions(object[key], params);
}); });
} else { } else {
Object.keys(object).forEach((key) => { resolved = object;
object = Object.assign({}, object, {
[key]: this.resolveSubstitutions(object[key], params)
});
});
} }
return object; return resolved;
} }
} }