fix loss of anki settings

This commit is contained in:
Alex Yatskov 2017-08-15 20:58:50 -07:00
parent 5c353f41e5
commit e079e5f252

View File

@ -96,9 +96,6 @@ async function onFormOptionsChanged(e) {
return; return;
} }
ankiErrorShow();
ankiSpinnerShow(true);
const {optionsNew, optionsOld} = await formRead(); const {optionsNew, optionsOld} = await formRead();
await optionsSave(optionsNew); await optionsSave(optionsNew);
@ -109,7 +106,9 @@ async function onFormOptionsChanged(e) {
optionsNew.anki.server !== optionsOld.anki.server; optionsNew.anki.server !== optionsOld.anki.server;
if (ankiUpdated) { if (ankiUpdated) {
ankiSpinnerShow(true);
await ankiDeckAndModelPopulate(optionsNew); await ankiDeckAndModelPopulate(optionsNew);
ankiErrorShow();
} }
} catch (e) { } catch (e) {
ankiErrorShow(e); ankiErrorShow(e);
@ -414,9 +413,6 @@ async function onAnkiModelChanged(e) {
return; return;
} }
ankiErrorShow();
ankiSpinnerShow(true);
const element = $(this); const element = $(this);
const tab = element.closest('.tab-pane'); const tab = element.closest('.tab-pane');
const tabId = tab.attr('id'); const tabId = tab.attr('id');
@ -425,7 +421,9 @@ async function onAnkiModelChanged(e) {
optionsNew.anki[tabId].fields = {}; optionsNew.anki[tabId].fields = {};
await optionsSave(optionsNew); await optionsSave(optionsNew);
ankiSpinnerShow(true);
await ankiFieldsPopulate(element, optionsNew); await ankiFieldsPopulate(element, optionsNew);
ankiErrorShow();
} catch (e) { } catch (e) {
ankiErrorShow(e); ankiErrorShow(e);
} finally { } finally {