mirror of
https://github.com/jcreek/SvelteKitSaasBoilerplate.git
synced 2026-07-15 03:53:48 +00:00
feat(#22): Hi Olly
This commit is contained in:
@@ -34,7 +34,7 @@
|
|||||||
redirectTo: '/account'
|
redirectTo: '/account'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
console.log(data, error);
|
console.log(data);
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
throw error;
|
throw error;
|
||||||
@@ -50,17 +50,19 @@
|
|||||||
email
|
email
|
||||||
})
|
})
|
||||||
.then(async (customer) => {
|
.then(async (customer) => {
|
||||||
console.log(customer);
|
// Create a new customer in the database customers table with id data.user.id and stripe_customer_id customer.id
|
||||||
const response = await supabase
|
const { dataFromUpsert, error } = await supabase.from('customers').upsert([
|
||||||
.from('customers')
|
{
|
||||||
.update({
|
id: data.user.id,
|
||||||
customer_id: customer.id
|
stripe_customer_id: customer.id
|
||||||
})
|
}
|
||||||
.match({
|
]);
|
||||||
id: data.user.id
|
|
||||||
});
|
|
||||||
|
|
||||||
console.log(response);
|
console.log(dataFromUpsert);
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -55,14 +55,14 @@ export const POST: RequestHandler = async ({ request }) => {
|
|||||||
case 'product.deleted':
|
case 'product.deleted':
|
||||||
await deleteProductRecord(event.data.object as stripe.Product);
|
await deleteProductRecord(event.data.object as stripe.Product);
|
||||||
break;
|
break;
|
||||||
case 'customer.created':
|
// case 'customer.created':
|
||||||
case 'customer.updated':
|
// case 'customer.updated':
|
||||||
// TODO - this should be passing the supabase customer uuid not the stripe customer id
|
// // TODO - this should be passing the supabase customer uuid not the stripe customer id
|
||||||
await createOrRetrieveCustomer({
|
// await createOrRetrieveCustomer({
|
||||||
email: (event.data.object as stripe.Customer).email!,
|
// email: (event.data.object as stripe.Customer).email!,
|
||||||
uuid: event.data.object.id
|
// uuid: event.data.object.id
|
||||||
});
|
// });
|
||||||
break;
|
// break;
|
||||||
case 'customer.subscription.created':
|
case 'customer.subscription.created':
|
||||||
case 'customer.subscription.updated':
|
case 'customer.subscription.updated':
|
||||||
case 'customer.subscription.deleted': {
|
case 'customer.subscription.deleted': {
|
||||||
|
|||||||
Reference in New Issue
Block a user