Here is my code:
apis: (originalImplementation) => {
return {
...originalImplementation,
thirdPartySignInUpPOST: async function (input) {
if (
originalImplementation.thirdPartySignInUpPOST === undefined
) {
throw Error('Should never come here');
}
// First we call the original implementation of thirdPartySignInUpPOST.
const response =
await originalImplementation.thirdPartySignInUpPOST(input);
// Post sign up response, we check if it was successful
if (response.status === 'OK') {
const { id, email } = response.user;
if (response.createdNewUser) {
const userInfo = await getSocialUserInfo(
response.user.thirdParty,
response.authCodeResponse,
);
console.log('User creation');
const created = await customerService.create(
id,
email,
userInfo,
);
console.log('user created');
// console.log('created', created);
}
}
return response;
},
};
},
},