Skip to content

Commit 4aee432

Browse files
authored
Merge pull request #375 from mosu-dev/fix#374
Fix#374 프로필 수정 및 등록 버튼 클릭시 disabled 처리 및 spinner 추가
2 parents a4322ac + 5b8c1c2 commit 4aee432

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

mosu-app/src/pages/mypage/profile/edit.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import { ButtonGroupFieldSet } from "@/shared/components/ButtonGroup";
2222
import { ErrorMessage } from "@/shared/components/FieldMessage/ErrorMessage";
2323
import { InputFieldSet } from "@/shared/components/Input";
2424
import { SelectFieldSet } from "@/shared/components/SelectField";
25+
import { Spinner } from "@/shared/components/Spinner/Spinner";
2526
import { ForbiddenException, HTTPException, UnauthorizedException } from "@/shared/errors/HTTPException";
2627
import { logger } from "@/shared/lib/logger";
2728
import { Button } from "@/shared/ui/button";
@@ -79,7 +80,7 @@ export default function MyPageProfilePage({ profileData }: InferGetServerSidePro
7980
}
8081
}, [educationValue, setValue]);
8182

82-
const { mutate } = useEditProfile();
83+
const { isPending, mutate } = useEditProfile();
8384

8485
const onSubmit = handleSubmit(
8586
(data) => {
@@ -203,8 +204,8 @@ export default function MyPageProfilePage({ profileData }: InferGetServerSidePro
203204
)}
204205
</div>
205206

206-
<Button variant="default" className="my-10 h-[60px] w-full">
207-
변경하기
207+
<Button variant="default" className="my-10 h-[60px] w-full" disabled={isPending}>
208+
{isPending ? <Spinner /> : "프로필 수정하기"}
208209
</Button>
209210
</section>
210211
</form>

mosu-app/src/pages/mypage/profile/register.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import { ButtonGroupFieldSet } from "@/shared/components/ButtonGroup";
2222
import { ErrorMessage } from "@/shared/components/FieldMessage/ErrorMessage";
2323
import { InputFieldSet } from "@/shared/components/Input";
2424
import { SelectFieldSet } from "@/shared/components/SelectField";
25+
import { Spinner } from "@/shared/components/Spinner/Spinner";
2526
import { ForbiddenException, HTTPException, UnauthorizedException } from "@/shared/errors/HTTPException";
2627
import { logger } from "@/shared/lib/logger";
2728
import { Button } from "@/shared/ui/button";
@@ -77,7 +78,7 @@ export default function MyPageProfilePage({ profileData }: InferGetServerSidePro
7778
}
7879
}, [educationValue, setValue]);
7980

80-
const { mutate } = useRegisterProfile();
81+
const { isPending, mutate } = useRegisterProfile();
8182

8283
const onSubmit = handleSubmit(
8384
(data) => {
@@ -206,8 +207,8 @@ export default function MyPageProfilePage({ profileData }: InferGetServerSidePro
206207
)}
207208
</div>
208209

209-
<Button variant="default" className="my-10 h-[60px] w-full">
210-
등록하기
210+
<Button variant="default" className="my-10 h-[60px] w-full" disabled={isPending}>
211+
{isPending ? <Spinner /> : "등록하기"}
211212
</Button>
212213
</section>
213214
</form>

0 commit comments

Comments
 (0)