mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-02-16 20:13:49 +00:00
Feat: Add edit user functionality
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import CreateUserValidationSchema from '@/services/User/schema/CreateUserValidationSchema';
|
||||
import { CreateUserValidationSchema } from '@/services/User/schema/CreateUserValidationSchemas';
|
||||
import GetUserSchema from '@/services/User/schema/GetUserSchema';
|
||||
import APIResponseValidationSchema from '@/validation/APIResponseValidationSchema';
|
||||
import { z } from 'zod';
|
||||
@@ -6,9 +6,7 @@ import { z } from 'zod';
|
||||
async function sendRegisterUserRequest(data: z.infer<typeof CreateUserValidationSchema>) {
|
||||
const response = await fetch('/api/users/register', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(data),
|
||||
});
|
||||
|
||||
|
||||
@@ -12,14 +12,14 @@ const validateEmail = async (email: string) => {
|
||||
}
|
||||
|
||||
const parsedPayload = z
|
||||
.object({ usernameIsTaken: z.boolean() })
|
||||
.object({ emailIsTaken: z.boolean() })
|
||||
.safeParse(parsed.data.payload);
|
||||
|
||||
if (!parsedPayload.success) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return !parsedPayload.data.usernameIsTaken;
|
||||
return !parsedPayload.data.emailIsTaken;
|
||||
};
|
||||
|
||||
export default validateEmail;
|
||||
|
||||
Reference in New Issue
Block a user