Good day! Can't make request, i don't know how to request information
const { id } = useParams();
const { data, isLoading } = jsonApi.useFetchStrategyQuery(id);
const { currentData } = catalogApi.useGetFundQuery(data.id)
Have the above hooks and question how call the hook on line 4 after the hook on line 2 completes.
useEffect() cannot be applied
First hook:
export const jsonApi = createApi({
reducerPath: 'jsonApi',
baseQuery: fetchBaseQuery({ baseUrl: config.jsonUrl }),
endpoints: build => ({
fetchStrategy: build.query<IStrategy, string | number | undefined>({
query: id => ({
url: `/static/strategies/${id}.json`,
}),
}),
fetchLegalEntity: build.query<LegalEntity, string>({
query: name => ({
url: `/static/legalEntities/${name}.json`,
}),
}),
}),
});
Second hook:
export const catalogApi = createApi({
reducerPath: 'catalogApi',
baseQuery: fetchBaseQuery({ baseUrl: config.infoApiUrl }),
endpoints: build => ({
getFund: build.query<Catalog[], string | number | undefined>({
query: id => ({
url: `/api/Products/${id}`,
}),
}),
}),
});
export const { useGetFundQuery } = catalogApi;