diff --git a/plugins/main/public/components/common/hooks/useGenericRequest.ts b/plugins/main/public/components/common/hooks/useGenericRequest.ts index dfdafb78ec..f6119b061f 100644 --- a/plugins/main/public/components/common/hooks/useGenericRequest.ts +++ b/plugins/main/public/components/common/hooks/useGenericRequest.ts @@ -22,7 +22,7 @@ export function useGenericRequest({ params = {}, resolveData = response => response, }: UseGenericRequestProps) { - const [response, setResponse] = useState({}); + const [data, setData] = useState({}); const [isLoading, setIsLoading] = useState(true); const [error, setError] = useState(); @@ -35,7 +35,7 @@ export function useGenericRequest({ path, params, ); - setResponse(response); + setData(resolveData(response)); }; fetchData(); } catch (error) { @@ -58,7 +58,7 @@ export function useGenericRequest({ return { isLoading, - data: resolveData(response), + data, error, }; }