fix: user is already part of a team (#20774)
* better error message * redirect to login if no user session * fixup * remove callback url since the same function is used by org and platform both * remove extra exclamation mark * implement PR feedback
This commit is contained in:
1 parent
02fb7c0ae0
commit
7dbfc1b2e0
4 files changed
+46
-14
No files matched your search
@@ -112,6 +112,7 @@ export const createHandler = async ({ input, ctx }: CreateOptions) => {
|
||||
slug: true,
|
||||
isOrganization: true,
|
||||
isPlatform: true,
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -173,7 +174,10 @@ export const createHandler = async ({ input, ctx }: CreateOptions) => {
|
||||
});
|
||||
|
||||
if (!!hasExistingPlatformOrOrgTeam?.team && isPlatform) {
|
||||
throw new TRPCError({ code: "BAD_REQUEST", message: "User is already part of a team" });
|
||||
throw new TRPCError({
|
||||
code: "BAD_REQUEST",
|
||||
message: `You can't create a new team because you are already a part of ${hasExistingPlatformOrOrgTeam.team.name}`,
|
||||
});
|
||||
}
|
||||
|
||||
const availability = getAvailabilityFromSchedule(DEFAULT_SCHEDULE);
|
||||
|
||||
Reference in new issue
Block a user