aboutsummaryrefslogtreecommitdiff
path: root/ext/js/data
diff options
context:
space:
mode:
Diffstat (limited to 'ext/js/data')
-rw-r--r--ext/js/data/options-util.js11
1 files changed, 7 insertions, 4 deletions
diff --git a/ext/js/data/options-util.js b/ext/js/data/options-util.js
index c3c0e685..a17763e9 100644
--- a/ext/js/data/options-util.js
+++ b/ext/js/data/options-util.js
@@ -17,6 +17,7 @@
*/
import {escapeRegExp, isObject} from '../core.js';
+import {parseJson, readResponseJson} from '../core/json.js';
import {TemplatePatcher} from '../templates/template-patcher.js';
import {JsonSchema} from './json-schema.js';
@@ -30,7 +31,8 @@ export class OptionsUtil {
/** */
async prepare() {
- const schema = /** @type {import('json-schema').Schema} */ (await this._fetchJson('/data/schemas/options-schema.json'));
+ /** @type {import('json-schema').Schema} */
+ const schema = await this._fetchJson('/data/schemas/options-schema.json');
this._optionsSchema = new JsonSchema(schema);
}
@@ -115,7 +117,7 @@ export class OptionsUtil {
}
});
});
- options = JSON.parse(optionsStr);
+ options = parseJson(optionsStr);
} catch (e) {
// NOP
}
@@ -477,12 +479,13 @@ export class OptionsUtil {
}
/**
+ * @template [T=unknown]
* @param {string} url
- * @returns {Promise<unknown>}
+ * @returns {Promise<T>}
*/
async _fetchJson(url) {
const response = await this._fetchGeneric(url);
- return await response.json();
+ return await readResponseJson(response);
}
/**