diff --git a/src/app/(user)/profile/[uid]/edit/EditProfileForm.tsx b/src/app/(user)/profile/[uid]/edit/EditProfileForm.tsx index 9c594bf..433ffc6 100644 --- a/src/app/(user)/profile/[uid]/edit/EditProfileForm.tsx +++ b/src/app/(user)/profile/[uid]/edit/EditProfileForm.tsx @@ -24,10 +24,9 @@ interface ProfileData { type EditProfileFormProps = { profileData: ProfileData; uid: string; - sessionUserId: string; }; -export default function EditProfileForm({ profileData, uid, sessionUserId }: EditProfileFormProps) { +export default function EditProfileForm({ profileData, uid }: EditProfileFormProps) { const router = useRouter(); const client = createSupabaseClient(); const profileForm = useForm>({ @@ -90,6 +89,7 @@ export default function EditProfileForm({ profileData, uid, sessionUserId }: Edi ( Avatar diff --git a/src/app/(user)/profile/[uid]/edit/page.tsx b/src/app/(user)/profile/[uid]/edit/page.tsx index 33a9e29..cc74a0c 100644 --- a/src/app/(user)/profile/[uid]/edit/page.tsx +++ b/src/app/(user)/profile/[uid]/edit/page.tsx @@ -33,7 +33,7 @@ export default async function ProfilePage({ params }: ProfilePageProps) {
Update Profile
- + ); } diff --git a/src/types/schemas/profile.schema.ts b/src/types/schemas/profile.schema.ts index 398f737..37ed46d 100644 --- a/src/types/schemas/profile.schema.ts +++ b/src/types/schemas/profile.schema.ts @@ -4,24 +4,21 @@ const MAX_FILE_SIZE = 500000; const ACCEPTED_IMAGE_TYPES = ["image/jpeg", "image/jpg", "image/png"]; const profileAvatarSchema = z - .custom( - (val) => - val && typeof val === "object" && "size" in val && "type" in val, - { - message: "Input must be a file.", - }, - ) - .refine((file) => file.size < MAX_FILE_SIZE, { - message: "File can't be bigger than 5MB.", - }) - .refine((file) => ACCEPTED_IMAGE_TYPES.includes(file.type), { - message: "File format must be either jpg, jpeg, or png.", - }).optional(); + .custom((val) => val && typeof val === "object" && "size" in val && "type" in val, { + message: "Input must be a file.", + }) + .refine((file) => file.size < MAX_FILE_SIZE, { + message: "File can't be bigger than 5MB.", + }) + .refine((file) => ACCEPTED_IMAGE_TYPES.includes(file.type), { + message: "File format must be either jpg, jpeg, or png.", + }) + .optional(); export const profileSchema = z.object({ - username: z.string().min(3).max(50).optional(), - full_name: z.string().min(4).max(100).optional(), - bio: z.string().min(10).max(1000).optional(), - updated_at: z.string().datetime().optional(), - avatars: profileAvatarSchema, + username: z.string().min(3).max(50).optional(), + full_name: z.string().min(4).max(100).optional(), + bio: z.string().max(1000).optional(), + updated_at: z.string().datetime().optional(), + avatars: profileAvatarSchema, });