mirror of
https://github.com/overleaf/overleaf.git
synced 2025-01-30 22:10:46 +00:00
Merge pull request #2387 from overleaf/jel-async-login
Convert V1LoginController._login to async GitOrigin-RevId: 2e51533126919f5a4ce71ca5d403a24773375333
This commit is contained in:
parent
0866b9de9b
commit
1a456da017
1 changed files with 21 additions and 2 deletions
|
@ -12,7 +12,6 @@
|
|||
* DS207: Consider shorter variations of null checks
|
||||
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
|
||||
*/
|
||||
let FeaturesUpdater
|
||||
const async = require('async')
|
||||
const PlansLocator = require('./PlansLocator')
|
||||
const _ = require('underscore')
|
||||
|
@ -27,7 +26,7 @@ const UserGetter = require('../User/UserGetter')
|
|||
|
||||
const oneMonthInSeconds = 60 * 60 * 24 * 30
|
||||
|
||||
module.exports = FeaturesUpdater = {
|
||||
const FeaturesUpdater = {
|
||||
refreshFeatures(user_id, callback) {
|
||||
if (callback == null) {
|
||||
callback = function(error, features, featuresChanged) {}
|
||||
|
@ -227,3 +226,23 @@ module.exports = FeaturesUpdater = {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
const refreshFeaturesPromise = user_id =>
|
||||
new Promise(function(resolve, reject) {
|
||||
FeaturesUpdater.refreshFeatures(
|
||||
user_id,
|
||||
(error, features, featuresChanged) => {
|
||||
if (error) {
|
||||
reject(error)
|
||||
} else {
|
||||
resolve({ features, featuresChanged })
|
||||
}
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
FeaturesUpdater.promises = {
|
||||
refreshFeatures: refreshFeaturesPromise
|
||||
}
|
||||
|
||||
module.exports = FeaturesUpdater
|
||||
|
|
Loading…
Reference in a new issue