fix /twilio/authorize
This commit is contained in:
parent
1f37eb45d5
commit
c1c3fa06a3
@ -24,9 +24,18 @@ export const loader: LoaderFunction = async ({ request }) => {
|
||||
const twilioMainAccount = await twilioClient.api.accounts(twilioMainAccountSid).fetch();
|
||||
console.log("twilioSubAccount", twilioSubAccount);
|
||||
console.log("twilioAccount", twilioMainAccount);
|
||||
const twilioAccount = await db.twilioAccount.update({
|
||||
const twilioAccount = await db.twilioAccount.upsert({
|
||||
where: { organizationId: organization.id },
|
||||
data: {
|
||||
create: {
|
||||
organization: {
|
||||
connect: { id: organization.id },
|
||||
},
|
||||
subAccountSid: twilioSubAccount.sid,
|
||||
subAccountAuthToken: encrypt(twilioSubAccount.authToken),
|
||||
accountSid: twilioMainAccount.sid,
|
||||
accountAuthToken: encrypt(twilioMainAccount.authToken),
|
||||
},
|
||||
update: {
|
||||
subAccountSid: twilioSubAccount.sid,
|
||||
subAccountAuthToken: encrypt(twilioSubAccount.authToken),
|
||||
accountSid: twilioMainAccount.sid,
|
||||
|
Loading…
Reference in New Issue
Block a user