From cf75c319865c05b88d5555a08773a7c61d4d6dbe Mon Sep 17 00:00:00 2001 From: Suejung Shin Date: Thu, 2 Jan 2025 01:27:15 -0800 Subject: [PATCH] cleanup --- .../useRegenerateOrgUploadToken.tsx | 31 +++++++++---------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/src/services/orgUploadToken/useRegenerateOrgUploadToken.tsx b/src/services/orgUploadToken/useRegenerateOrgUploadToken.tsx index b4c2fec572..03bcf2a693 100644 --- a/src/services/orgUploadToken/useRegenerateOrgUploadToken.tsx +++ b/src/services/orgUploadToken/useRegenerateOrgUploadToken.tsx @@ -63,25 +63,24 @@ export function useRegenerateOrgUploadToken({ query, variables: { input: { owner } }, mutationPath: 'RegenerateOrgUploadToken', + }).then(({ data }) => { + const parsedRes = ResponseSchema.safeParse(data) + if (!parsedRes.success) { + return rejectNetworkError({ + status: 404, + data: {}, + dev: 'useRegenerateOrgUploadToken - 404 schema parsing failed', + error: parsedRes.error, + }) + } + + return parsedRes.data.regenerateOrgUploadToken }) }, useErrorBoundary: true, - onSuccess: ({ data }) => { - const parsedRes = ResponseSchema.safeParse(data) - if (!parsedRes.success) { - return rejectNetworkError({ - status: 404, - data: {}, - dev: 'useRegenerateOrgUploadToken - 404 schema parsing failed', - error: parsedRes.error, - }) - } - - onSuccess(parsedRes.data.regenerateOrgUploadToken) - }, - onSettled: () => { - queryClient.invalidateQueries(['DetailOwner']) + onSuccess: (res) => { + onSuccess(res) + queryClient.invalidateQueries(['DetailOwner', 'GetOrgUploadToken']) }, - retry: false, }) }