Remove redundant code in pokeApi.ts
parent
c7d7db22da
commit
7bb4fde73e
|
@ -9,10 +9,7 @@ import {
|
||||||
PokemonResponseData,
|
PokemonResponseData,
|
||||||
EvolutionChainResponseData,
|
EvolutionChainResponseData,
|
||||||
PokemonSpeciesResponseData,
|
PokemonSpeciesResponseData,
|
||||||
EvolutionChain,
|
|
||||||
} from 'types/api';
|
} from 'types/api';
|
||||||
import { InfoDialogComponentProps } from 'components/InfoDialogComponent';
|
|
||||||
import { EvolutionSpeciesProps } from 'components/EvolutionSpecies';
|
|
||||||
|
|
||||||
export interface pokeApiFullListFetchArgs extends FetchArgs {
|
export interface pokeApiFullListFetchArgs extends FetchArgs {
|
||||||
fetchAllPages?: boolean;
|
fetchAllPages?: boolean;
|
||||||
|
@ -48,23 +45,6 @@ async function fetchAllPages(url: string | null) {
|
||||||
return allResults;
|
return allResults;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const convertEvolutionChainResponseDataToEvolutionSpeciesProps = (
|
|
||||||
evo: EvolutionChainResponseData,
|
|
||||||
): EvolutionSpeciesProps[] => {
|
|
||||||
const result: EvolutionSpeciesProps[] = [];
|
|
||||||
// const addEvolutionSpeciesProps = (evo: EvolutionChain, level: number) => {
|
|
||||||
// result.push({
|
|
||||||
// name: evo.species.name,
|
|
||||||
// });
|
|
||||||
// evo.evolves_to.forEach(evo => {
|
|
||||||
// addEvolutionSpeciesProps(evo, level + 1);
|
|
||||||
// });
|
|
||||||
// };
|
|
||||||
//
|
|
||||||
// addEvolutionSpeciesProps(evo.chain, 0);
|
|
||||||
return result;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const paginationBaseQuery = (baseUrl: string) =>
|
export const paginationBaseQuery = (baseUrl: string) =>
|
||||||
fetchBaseQuery({ baseUrl });
|
fetchBaseQuery({ baseUrl });
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue