Closed Gabb-c closed 9 months ago
Now the Base URL can be changed if needed:
protected async getResourceByURL<T>(url: string, baseURL = BASE_URL.REST): Promise<T> {
const ENDPOINT = url.split("v2")[1] as string;
return (await this.api.get<T>(ENDPOINT, { baseURL })).data;
}
Example:
import { UtilityClient } from "pokenode-ts";
const client = new UtilityClient();
const data = client.getResourceByUrl("https://pokeapi.co/api/v2/pokemon/luxray", "customPokeAPIInstance");
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This issue has been automatically closed because it has not had recent activity. Thank you for your contributions.
Discussed in https://github.com/Gabb-c/pokenode-ts/discussions/887