🚸 (billing) Make sure customer is not created before launching checkout page

This commit is contained in:
Baptiste Arnaud
2023-08-22 10:29:00 +02:00
parent c08e0cdb0a
commit 53dd7ba499
13 changed files with 108 additions and 43 deletions

View File

@@ -25,7 +25,6 @@ const workspaceContext = createContext<{
createWorkspace: (name?: string) => Promise<void>
updateWorkspace: (updates: { icon?: string; name?: string }) => void
deleteCurrentWorkspace: () => Promise<void>
refreshWorkspace: () => void
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
//@ts-ignore
}>({})
@@ -166,11 +165,6 @@ export const WorkspaceProvider = ({
await deleteWorkspaceMutation.mutateAsync({ workspaceId })
}
const refreshWorkspace = () => {
trpcContext.workspace.getWorkspace.invalidate()
trpcContext.billing.getSubscription.invalidate()
}
return (
<workspaceContext.Provider
value={{
@@ -181,7 +175,6 @@ export const WorkspaceProvider = ({
createWorkspace,
updateWorkspace,
deleteCurrentWorkspace,
refreshWorkspace,
}}
>
{children}

View File

@@ -2,7 +2,7 @@ import { MemberInWorkspace, User } from '@typebot.io/prisma'
export const isAdminWriteWorkspaceForbidden = (
workspace: {
members: MemberInWorkspace[]
members: Pick<MemberInWorkspace, 'role' | 'userId'>[]
},
user: Pick<User, 'email' | 'id'>
) => {