2
0

🐛 (editor) inconsistency in route change auto save

This commit is contained in:
Baptiste Arnaud
2022-10-12 07:42:32 +02:00
parent d1cc9180c8
commit b46d35214d
4 changed files with 23 additions and 16 deletions

View File

@@ -16,7 +16,10 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
const workspaceId = req.query.workspaceId as string | undefined
if (!workspaceId) return badRequest(res, 'workspaceId is required')
const workspace = await prisma.workspace.findFirst({
where: { id: workspaceId, members: { some: { userId: user.id } } },
where:
user.email === process.env.ADMIN_EMAIL
? undefined
: { id: workspaceId, members: { some: { userId: user.id } } },
select: { plan: true },
})
if (!workspace) return forbidden(res)