Properly deletes authData.provider when set to null

This commit is contained in:
Florent Vilmart
2016-03-17 12:05:31 -04:00
parent 7194fb195c
commit 21fb14d8f4

View File

@@ -260,7 +260,14 @@ function transformUpdate(schema, className, restUpdate) {
function transformAuthData(restObject) {
if (restObject.authData) {
Object.keys(restObject.authData).forEach((provider) => {
restObject[`_auth_data_${provider}`] = restObject.authData[provider];
let providerData = restObject.authData[provider];
if (providerData == null) {
restObject[`_auth_data_${provider}`] = {
__op: 'Delete'
}
} else {
restObject[`_auth_data_${provider}`] = providerData;
}
});
delete restObject.authData;
}
@@ -823,4 +830,3 @@ module.exports = {
transformWhere: transformWhere,
untransformObject: untransformObject
};