Open History to see the last commit
1export const getEpisodes = async () => {
2 const res = await fetch('https://rickandmortyapi.com/api/episode/')
3 return await res.json()
4}
5β
6export const getEpisode = async (episodeId: string) => {
7 const res = await fetch(
8 `https://rickandmortyapi.com/api/episode/${episodeId}`,
9 )
10 return await res.json()
11}
12β
13export const getCharacters = async () => {
14 const res = await fetch('https://rickandmortyapi.com/api/character/')
15 return await res.json()
16}
17β
18export const getCharacter = async (characterId: string) => {
19 const res = await fetch(
20 `https://rickandmortyapi.com/api/character/${characterId}`,
21 )
22 return await res.json()
23}
24β
25export const getLocation = async (locationId: string) => {
26 const res = await fetch(
27 `https://rickandmortyapi.com/api/location/${locationId}`,
28 )
29 return await res.json()
30}