Replace all trivial Promise.defer usages with regular Promises
(cherry picked from commit 44401d73b4
)
This commit is contained in:
parent
548e38cba9
commit
217dfc3eed
5 changed files with 122 additions and 138 deletions
|
@ -312,18 +312,14 @@ async function _restoreFromLocalStorage(opts) {
|
|||
function _handleLoadSessionFailure(e) {
|
||||
console.error("Unable to load session", e);
|
||||
|
||||
const def = Promise.defer();
|
||||
const SessionRestoreErrorDialog =
|
||||
sdk.getComponent('views.dialogs.SessionRestoreErrorDialog');
|
||||
|
||||
Modal.createTrackedDialog('Session Restore Error', '', SessionRestoreErrorDialog, {
|
||||
const modal = Modal.createTrackedDialog('Session Restore Error', '', SessionRestoreErrorDialog, {
|
||||
error: e.message,
|
||||
onFinished: (success) => {
|
||||
def.resolve(success);
|
||||
},
|
||||
});
|
||||
|
||||
return def.promise.then((success) => {
|
||||
return modal.finished.then(([success]) => {
|
||||
if (success) {
|
||||
// user clicked continue.
|
||||
_clearStorage();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue