Fix profile accordion error display

This commit is contained in:
ajnart
2024-05-10 20:02:57 +02:00
parent 6e2bd0ce11
commit 543bfc0835
5 changed files with 21 additions and 15 deletions

View File

@@ -33,11 +33,11 @@ export const userRouter = createTRPCRouter({
.input(validation.user.create)
.mutation(async ({ ctx, input }) => {
const user = await ctx.db.query.users.findFirst({
where: eq(users.name, input.username),
where: eq(users.name, input.username.toLowerCase()),
});
if (user !== undefined) {
throw new TRPCError({
code: "FORBIDDEN",
code: "CONFLICT",
message: "User already exists",
});
}
@@ -91,12 +91,12 @@ export const userRouter = createTRPCRouter({
.where(eq(users.id, input.userId))
.limit(1);
const existingUser = await ctx.db.query.users.findFirst({
where: eq(users.name, input.form.name),
where: eq(users.name, input.form.name.toLowerCase()),
});
if (existingUser !== undefined) {
throw new TRPCError({
code: "FORBIDDEN",
code: "CONFLICT",
message: `User ${input.form.name} already exists`,
});
}