Merge pull request #504 from jesperordrup/main
Fix: error message https://github.com/coollabsio/coolify/issues/502
This commit is contained in:
commit
9a0a145374
1 changed files with 7 additions and 3 deletions
|
|
@ -273,11 +273,15 @@ export async function inviteToTeam(request: FastifyRequest<InviteToTeam>, reply:
|
||||||
const { email, permission, teamId, teamName } = request.body;
|
const { email, permission, teamId, teamName } = request.body;
|
||||||
const userFound = await prisma.user.findUnique({ where: { email } });
|
const userFound = await prisma.user.findUnique({ where: { email } });
|
||||||
if (!userFound) {
|
if (!userFound) {
|
||||||
throw `No user found with '${email}' email address.`
|
throw {
|
||||||
|
message: `No user found with '${email}' email address.`
|
||||||
|
};
|
||||||
}
|
}
|
||||||
const uid = userFound.id;
|
const uid = userFound.id;
|
||||||
if (uid === userId) {
|
if (uid === userId) {
|
||||||
throw `Invitation to yourself? Whaaaaat?`
|
throw {
|
||||||
|
message: `Invitation to yourself? Whaaaaat?`
|
||||||
|
};
|
||||||
}
|
}
|
||||||
const alreadyInTeam = await prisma.team.findFirst({
|
const alreadyInTeam = await prisma.team.findFirst({
|
||||||
where: { id: teamId, users: { some: { id: uid } } }
|
where: { id: teamId, users: { some: { id: uid } } }
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue