mirror of
https://github.com/flarum/core.git
synced 2025-08-12 03:14:33 +02:00
infrastructure: Replace m.deferred in Application with native promise functionality
This commit is contained in:
committed by
Franz Liedke
parent
44975bc606
commit
5b3914535d
@@ -343,10 +343,8 @@ export default class Application {
|
|||||||
|
|
||||||
// Now make the request. If it's a failure, inspect the error that was
|
// Now make the request. If it's a failure, inspect the error that was
|
||||||
// returned and show an alert containing its contents.
|
// returned and show an alert containing its contents.
|
||||||
const deferred = m.deferred();
|
return m.request(options).then(
|
||||||
|
(response) => response,
|
||||||
m.request(options).then(
|
|
||||||
(response) => deferred.resolve(response),
|
|
||||||
(error) => {
|
(error) => {
|
||||||
let children;
|
let children;
|
||||||
|
|
||||||
@@ -408,11 +406,9 @@ export default class Application {
|
|||||||
this.requestErrorAlert = this.alerts.show(error.alert);
|
this.requestErrorAlert = this.alerts.show(error.alert);
|
||||||
}
|
}
|
||||||
|
|
||||||
deferred.reject(error);
|
return Promise.reject(error);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
return deferred.promise;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user