Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/apis/users/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { z } from 'zod';
import { SIGNUP_FORM_VALID_LENGTH, SIGNUP_FORM_ERROR_MESSAGE } from '@/constants/auth';
import { PROFILEEDIT_FORM_VALID_LENGTH, PROFILEEDIT_FORM_ERROR_MESSAGE } from '@/constants/profileEdit';

interface FailResponse {
message: string;
Expand Down Expand Up @@ -44,7 +45,7 @@ export type SignupResponse = Promise<SignupSuccessResponse | SignupFailResponse>
type ProfileImageUrl = string | URL | null;

export const updateUserFormSchema = z.object({
nickname: z.string(),
nickname: z.string().max(PROFILEEDIT_FORM_VALID_LENGTH.NICKNAME.MAX, PROFILEEDIT_FORM_ERROR_MESSAGE.NICKNAME.MAX),
profileImageUrl: z.string(),
});

Expand Down
4 changes: 2 additions & 2 deletions src/components/profile/ProfileEdit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ export default function ProfileEdit() {
{/* 프로필 수정 폼 */}
<form onSubmit={handleSubmit(handleSave)} className='w-[252px] md:w-[276px] lg:w-[400px]'>
<Input label='이메일' placeholder={currentEmail} readOnly className='mb-4 w-full' />
<Input label='닉네임' placeholder={currentNickname} {...register('nickname')} error={errors.nickname?.message} className='mb-4 w-full' />
<SubmitButton isValid={isValid && isFormChanged} isSubmitting={isSubmitting} text='저장' className='w-full' />
<Input label='닉네임' placeholder={currentNickname} {...register('nickname')} error={errors.nickname?.message} className='w-full' />
<SubmitButton isValid={isValid && isFormChanged} isSubmitting={isSubmitting} text='저장' className='mt-4 w-full' />
</form>
</div>
</div>
Expand Down
15 changes: 15 additions & 0 deletions src/constants/profileEdit.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
export const PROFILEEDIT_FORM_PLACEHOLDER = {
NICKNAME: '닉네임을 입력해 주세요',
} as const;

export const PROFILEEDIT_FORM_VALID_LENGTH = {
NICKNAME: {
MAX: 10,
},
} as const;

export const PROFILEEDIT_FORM_ERROR_MESSAGE = {
NICKNAME: {
MAX: '열 자 이하로 작성해 주세요',
},
} as const;