File tree Expand file tree Collapse file tree
(store)/stores/register/_components/RegisterFunnel/_components/ImagesStep Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -38,7 +38,9 @@ export const ImagesStep = ({
3838} : ImageStepProps ) => {
3939 const { data : member } = useQuery ( memberQueryOptions ) ;
4040
41- const { mutateAsync : postCheer , isPending } = usePostCheerMutation ( ) ;
41+ const [ isPending , setIsPending ] = useState ( false ) ;
42+
43+ const { mutateAsync : postCheer } = usePostCheerMutation ( ) ;
4244
4345 const [ images , setImages ] = useState < File [ ] > ( [ ] ) ;
4446
@@ -59,6 +61,8 @@ export const ImagesStep = ({
5961 fileSize : number ;
6062 } > = [ ] ;
6163
64+ setIsPending ( true ) ;
65+
6266 if ( submitType === "with-images" && images . length > 0 ) {
6367 const { urls : presignedUrls } = await getPresignedUrl (
6468 images . map ( ( image , index ) => ( {
@@ -95,6 +99,8 @@ export const ImagesStep = ({
9599 if ( error instanceof ApiException ) {
96100 toast . error ( error . message ) ;
97101 }
102+ } finally {
103+ setIsPending ( false ) ;
98104 }
99105 } ;
100106
Original file line number Diff line number Diff line change 22
33import { zodResolver } from "@hookform/resolvers/zod" ;
44import { useRouter } from "next/navigation" ;
5+ import { useState } from "react" ;
56import { FormProvider , useForm } from "react-hook-form" ;
67
78import { getPresignedUrl , uploadImageToS3 } from "@/app/_api/image/image.api" ;
@@ -23,7 +24,9 @@ import * as styles from "./page.css";
2324export default function StoryRegisterPage ( ) {
2425 const { file, clearUpload } = useImageUploadContext ( ) ;
2526 const router = useRouter ( ) ;
26- const { mutate : postStory , isPending } = usePostStoryMutation ( ) ;
27+
28+ const [ isPending , setIsPending ] = useState ( false ) ;
29+ const { mutate : postStory } = usePostStoryMutation ( ) ;
2730
2831 const handleClick = ( ) => {
2932 router . back ( ) ;
@@ -45,6 +48,8 @@ export default function StoryRegisterPage() {
4548 let imageData : ImageRequest [ ] = [ ] ;
4649
4750 if ( data . image ) {
51+ setIsPending ( true ) ;
52+
4853 const { urls : presignedUrls } = await getPresignedUrl ( [
4954 {
5055 order : 0 ,
@@ -85,6 +90,8 @@ export default function StoryRegisterPage() {
8590 ) ;
8691 } catch ( error ) {
8792 console . error ( "이미지 업로드 실패:" , error ) ;
93+ } finally {
94+ setIsPending ( false ) ;
8895 }
8996 } ;
9097
You can’t perform that action at this time.
0 commit comments