web-manager 3.1.13 → 3.1.14
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/account.js +19 -0
- package/package.json +1 -1
package/lib/account.js
CHANGED
@@ -151,6 +151,25 @@ Account.prototype.delete = function (options) {
|
|
151
151
|
});
|
152
152
|
}
|
153
153
|
|
154
|
+
Account.prototype.resolve = function (account, options) {
|
155
|
+
var self = this;
|
156
|
+
return new Promise(function(resolve, reject) {
|
157
|
+
var currentUser = firebase.auth().currentUser;
|
158
|
+
|
159
|
+
// If there is no user logged in or we choose not to fetch the account, resolve a default account
|
160
|
+
if (!currentUser || !currentUser.uid || options.fetchNewAccount === false) {
|
161
|
+
return resolve(self._resolveAccount(currentUser, account, options));
|
162
|
+
}
|
163
|
+
|
164
|
+
// Otherwise, fetch the account from the database and resolve it
|
165
|
+
firebase.firestore().doc('users/' + currentUser.uid)
|
166
|
+
.get()
|
167
|
+
.then(function (doc) {
|
168
|
+
return resolve(self._resolveAccount(currentUser, doc.data(), options));
|
169
|
+
})
|
170
|
+
});
|
171
|
+
}
|
172
|
+
|
154
173
|
Account.prototype.resolve = function (account, options) {
|
155
174
|
var self = this;
|
156
175
|
return new Promise(function(resolve, reject) {
|
package/package.json
CHANGED