fix some unhandled promises and refactor some code

This commit is contained in:
dkanada 2021-02-06 15:51:31 +09:00
parent d7161f9d65
commit df599db415
9 changed files with 8 additions and 23 deletions

View File

@ -33,14 +33,7 @@ import globalize from '../scripts/globalize';
});
options.buttons = items;
return dialog.show(options).then(function (result) {
if (result === 'ok') {
return Promise.resolve();
}
return Promise.reject();
});
return dialog.show(options);
}
return Promise.resolve();

View File

@ -106,15 +106,6 @@ import '../../assets/css/scrollstyles.css';
tryRemoveElement(dlg);
}
}
//resolve();
// if we just called history.back(), then use a timeout to allow the history events to fire first
setTimeout(() => {
resolve({
element: dlg,
closedByBack: self.closedByBack
});
}, 1);
}
dlg.addEventListener('close', onDialogClosed);
@ -265,6 +256,7 @@ import '../../assets/css/scrollstyles.css';
dom.addEventListener(dlg, dom.whichAnimationEvent(), onFinish, {
once: true
});
return;
}

View File

@ -319,6 +319,7 @@ import confirm from '../confirm/confirm';
alert({
text: globalize.translate('PleaseSelectTwoItems')
});
return;
}

View File

@ -11,7 +11,6 @@ import '../../elements/emby-input/emby-input';
import '../formdialog.css';
import template from './prompt.template.html';
/* eslint-disable indent */
export default (() => {
function replaceAll(str, find, replace) {
return str.split(find).join(replace);
@ -127,4 +126,3 @@ export default (() => {
};
}
})();
/* eslint-enable indent */

View File

@ -112,7 +112,7 @@ export default function (page, providerId, options) {
providerId = result.Id;
reload();
}, function () {
Dashboard.alert({ // ApiClient.ajax() error handler
Dashboard.alert({
message: globalize.translate('ErrorSavingTvProvider')
});
});

View File

@ -102,9 +102,9 @@ import confirm from '../../components/confirm/confirm';
case 'sendmessage':
showSendMessageForm(btn, session);
break;
case 'transcodinginfo':
showPlaybackInfo(btn, session);
break;
}
});
});

View File

@ -31,6 +31,7 @@ export const activate = () => {
title: globalize.translate('HeaderError'),
message: globalize.translate('DefaultErrorMessage')
});
throw e;
});
};

View File

@ -28,7 +28,7 @@ function showMessage(text, userSettingsKey, appHostFeature) {
}
userSettings.set(userSettingsKey, '1', false);
return alert(text).catch(() => { /* ignore exceptions */ });
return alert(text);
}
function showBlurayMessage() {

View File

@ -65,7 +65,7 @@ export async function serverAddress() {
}));
}).then(configs => {
const selection = configs.find(obj => !obj.config.StartupWizardCompleted) || configs[0];
return Promise.resolve(selection.url);
return Promise.resolve(selection?.url);
}).catch(error => {
console.log(error);
return Promise.resolve();