This commit is contained in:
Chris Bianca
2017-11-23 17:30:12 +00:00
2 changed files with 12 additions and 3 deletions

View File

@@ -204,8 +204,11 @@ export default class Reference extends ReferenceBase {
return new Promise((resolve, reject) => {
const onCompleteWrapper = (error, committed, snapshotData) => {
if (isFunction(onComplete)) {
if (error) return onComplete(error, committed, null);
return onComplete(null, committed, new Snapshot(this, snapshotData));
if (error) {
onComplete(error, committed, null);
} else {
onComplete(null, committed, new Snapshot(this, snapshotData));
}
}
if (error) return reject(error);