killian.s
03/22/2022, 12:40 AMjavascript
import axios from "axios";
const override = (originalImplementation) => {
return {
...originalImplementation,
thirdPartySignInUpPOST: async function (input) {
if (originalImplementation.thirdPartySignInUpPOST === undefined) {
throw Error("Should never come here");
}
let response = await originalImplementation.thirdPartySignInUpPOST(input);
if (response.status === "OK") {
if (response.createdNewUser) {
axios({
url: `${process.env.API_URL}/graphql`,
method: "post",
data: {
query: `
mutation CreateUser($userId: String!, $email: String!, $firstName: String!, $lastName: String!) {
createUser(userId: $userId, email: $email, firstName: $firstName, lastName: $lastName) {
userId
email
firstName
lastName
}
}`,
variables: {
userId: response.user.id,
email: response.user.email,
firstName: "Killian",
lastName: "",
},
},
});
}
}
return response;
},
};
};
export default override;
This is how I did it for 0Auth. So I can I ajust this for Email and Password?