feat: update profile #150
Conversation
|
Thank you for following the naming conventions for pull request titles! 🙏 |
|
@dahal @chetannn I think it's ready for review. |
| where: { | ||
| status: "ACTIVE", | ||
| id: user.memberId, | ||
| companyId: user.companyId, |
There was a problem hiding this comment.
filtering by companyId is not necessary here.
| FormLabel, | ||
| FormMessage, | ||
| } from "@/components/ui/form"; | ||
| const profileSettingsSchema = z.object({ |
There was a problem hiding this comment.
Move this schema to a dedicated file so that it can be used on the backend as well.
| const [file, setFile] = useState<File | null>(null); | ||
| const fileInputRef = useRef<HTMLInputElement>(null); | ||
|
|
||
| // @ts-expect-error: xxxx |
| resolver: zodResolver(profileSettingsSchema), | ||
| }); | ||
|
|
||
| // @ts-expect-error: xxxx |
| }, | ||
| }); | ||
|
|
||
| useEffect(() => { |
There was a problem hiding this comment.
I think we need to fetch data initially from the server component and pass the profile as prop. useEffect is redundant here.
| } | ||
| }, [memberProfile?.data, form]); | ||
|
|
||
| const handleImageUpload = async ( |
| const handleFileChange = (event: React.ChangeEvent<HTMLInputElement>) => { | ||
| const files = event.target.files; | ||
|
|
||
| if (files?.[0]) { |
There was a problem hiding this comment.
Extract the file validation logic to a utils.
| const handleRemoveAvatar = () => { | ||
| setFile(null); | ||
| }; | ||
| async function onSubmit(values: z.infer<typeof profileSettingsSchema>) { |
There was a problem hiding this comment.
Changing a profile picture and saving profile information are two different actions like I said the day before. Clicking on save button should only save the profile information.
ghost
left a comment
There was a problem hiding this comment.
I have requested for some changes. Awesome work BTW
|
@chetannn I think I fixed the requested changes ?? |
* feat:update-profile-procedure * feat:zod schema for update profile input * feat: get-user-profile-procedure * feat: edit-profile-page * update to update-profile-procedures * get-profile-procedure updated * member-router schema update * env changes * new routers registered in root member router * session-sync-with-profile-update * update: profile-page * update: procedure-upatate-profile * update: schema-member-router * update: server/auth * minor fix * feat: added bucketMode props to s3 uploader * minor fix * minor change in payload-action-type enum * types * added zod-schemas * fix: member-router-schema * update: profile-page * update: update-profile-procedure * added enum in constants * update * update * update utils
PR for issue #139