and here is the code for the +page.ts: import type { PageLoad } from "./$types"
export const load = (async ({ fetch }) => {
const response = await fetch('https://pokeapi.co/api/v2/pokemon?limit=151')
const json = await response.json()
const monsters = await Promise.all(json.results.map(async (monster) => {
const splitUrl = monster.url.split('/')
const id = splitUrl[splitUrl.length - 2]
const response = await fetch(https://pokeapi.co/api/v2/pokemon/${id});
const pokemon = await response.json();
return {
name: monster.name,
url: monster.url,
id,
image: https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/${id}.png,
}
}))
return {
monsters
}
}) satisfies PageLoad