return early when data is not available as expected

This commit is contained in:
m5r
2021-08-02 18:02:49 +08:00
parent 09568ef684
commit 827ed9f1c0
11 changed files with 88 additions and 43 deletions

View File

@ -14,9 +14,12 @@ export default resolver.pipe(
resolver.authorize(),
async ({ twilioAccountSid, twilioAuthToken }, context) => {
const customer = await getCurrentCustomer(null, context);
const customerId = customer!.id;
if (!customer) {
return;
}
await db.customer.update({
where: { id: customerId },
where: { id: customer.id },
data: {
accountSid: twilioAccountSid,
authToken: twilioAuthToken,