@@ -5,6 +5,7 @@ import { apiClient } from "@/lib/reactQueryProvider";
55import { useToastInfo } from "@/components/atoms/toast.atom" ;
66import { QUERY_KEY } from "@/queries/getHintList" ;
77import extractFilename from "@/utils/helper" ;
8+ import { getStatus } from "@/utils/localStorage" ;
89
910interface PreSignedUrlRequest {
1011 themeId : number ;
@@ -76,13 +77,22 @@ const postHint = (data: HintData) => apiClient.post("/v1/hint", data);
7677const useHintUpload = ( ) => {
7778 const [ , setToast ] = useToastInfo ( ) ;
7879 const queryClient = useQueryClient ( ) ;
79-
80+ const status = getStatus ( ) ;
8081 const presignedMutation = useMutation <
8182 PreSignedUrlResponse ,
8283 AxiosError < AxiosSameCodeError > ,
8384 PreSignedUrlRequest
8485 > ( {
85- mutationFn : getPreSignedUrl ,
86+ mutationFn : async ( params ) => {
87+ if ( status ?. includes ( "SUBSCRIPTION" ) ) {
88+ return getPreSignedUrl ( params ) ;
89+ }
90+ return {
91+ code : 200 ,
92+ message : "No operation" ,
93+ data : { hintImageUrlList : [ ] , answerImageUrlList : [ ] } ,
94+ } ;
95+ } ,
8696 onError : ( error ) => {
8797 setToast ( {
8898 isOpen : true ,
@@ -109,14 +119,11 @@ const useHintUpload = () => {
109119 HintData
110120 > ( {
111121 mutationFn : ( data ) => ( data . id > 0 ? putHint ( data ) : postHint ( data ) ) ,
112- onSuccess : ( data ) => {
122+ onSuccess : ( ) => {
113123 queryClient . invalidateQueries ( QUERY_KEY ) ;
114124 setToast ( {
115125 isOpen : true ,
116- title :
117- data . config . method === "put"
118- ? "힌트를 수정했습니다."
119- : "힌트를 추가했습니다." ,
126+ title : "힌트가 성공적으로 등록되었습니다." ,
120127 text : "" ,
121128 } ) ;
122129 } ,
0 commit comments