Skip to content

Commit 91b4903

Browse files
committed
fix: 롤백됐나,, 구독 권한 없을 시 403 뜨는 에러 수정
1 parent 535574f commit 91b4903

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

app/queries/getPreSignedUrl.ts

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { apiClient } from "@/lib/reactQueryProvider";
55
import { useToastInfo } from "@/components/atoms/toast.atom";
66
import { QUERY_KEY } from "@/queries/getHintList";
77
import extractFilename from "@/utils/helper";
8+
import { getStatus } from "@/utils/localStorage";
89

910
interface PreSignedUrlRequest {
1011
themeId: number;
@@ -76,13 +77,22 @@ const postHint = (data: HintData) => apiClient.post("/v1/hint", data);
7677
const 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

Comments
 (0)