Move apiOptionsSave implementation into Backend

This commit is contained in:
toasted-nutbread 2019-12-09 21:11:10 -05:00
parent 6a1cfbaad6
commit 8dff73679e
2 changed files with 6 additions and 7 deletions

View File

@ -29,11 +29,8 @@ function apiOptionsGetFull() {
return utilBackend()._onApiOptionsGetFull(); return utilBackend()._onApiOptionsGetFull();
} }
async function apiOptionsSave(source) { function apiOptionsSave(source) {
const backend = utilBackend(); return utilBackend()._onApiOptionsSave({source});
const options = await apiOptionsGetFull();
await optionsSave(options);
backend.onOptionsUpdated(source);
} }
async function apiTermsFind(text, details, optionsContext) { async function apiTermsFind(text, details, optionsContext) {

View File

@ -234,8 +234,10 @@ class Backend {
await this._optionsSave({source}); await this._optionsSave({source});
} }
_onApiOptionsSave({source}) { async _onApiOptionsSave({source}) {
return apiOptionsSave(source); const options = await this.getFullOptions();
await optionsSave(options);
this.onOptionsUpdated(source);
} }
_onApiKanjiFind({text, optionsContext}) { _onApiKanjiFind({text, optionsContext}) {