Check STRIPE_PRIVATE_KEY exists before stripe call during disband (#2454)

pull/2423/head^2
Alex van Andel 2022-04-10 16:57:08 +01:00 committed by GitHub
parent 66aeadffbb
commit 5e3da4d178
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -149,7 +149,9 @@ export const viewerTeamsRouter = createProtectedRouter()
async resolve({ ctx, input }) {
if (!(await isTeamOwner(ctx.user?.id, input.teamId))) throw new TRPCError({ code: "UNAUTHORIZED" });
await downgradeTeamMembers(input.teamId);
if (process.env.STRIPE_PRIVATE_KEY) {
await downgradeTeamMembers(input.teamId);
}
// delete all memberships
await ctx.prisma.membership.deleteMany({