Open History to see the last commit
1export const getFilms = async () => {
2 const res = await fetch('https://swapi.dev/api/films/')
3 return await res.json()
4}
5β
6export const getFilm = async (filmId: string) => {
7 const res = await fetch(`https://swapi.dev/api/films/${filmId}/`)
8 return await res.json()
9}
10β
11export const getCharacters = async () => {
12 const res = await fetch('https://swapi.dev/api/people/')
13 return await res.json()
14}
15β
16export const getCharacter = async (characterId: string) => {
17 const res = await fetch(`https://swapi.dev/api/people/${characterId}/`)
18 return await res.json()
19}
20β
21export const getPlanet = async (planetId: string) => {
22 const res = await fetch(`https://swapi.dev/api/planets/${planetId}/`)
23 return await res.json()
24}