Skip to content

Commit

Permalink
Updated SWAPI
Browse files Browse the repository at this point in the history
  • Loading branch information
mattpocock committed Jan 1, 2025
1 parent e7029ea commit e430c2d
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
8 changes: 5 additions & 3 deletions src/09-promises.problem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ interface LukeSkywalker {
}

export const fetchLukeSkywalker = async (): LukeSkywalker => {
const data = await fetch("https://swapi.dev/api/people/1").then((res) => {
return res.json();
});
const data = await fetch("https://swapi.py4e.com/api/people/1").then(
(res) => {
return res.json();
}
);

return data;
};
8 changes: 5 additions & 3 deletions src/09-promises.solution.1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ interface LukeSkywalker {
}

export const fetchLukeSkywalker = async (): Promise<LukeSkywalker> => {
const data = await fetch("https://swapi.dev/api/people/1").then((res) => {
return res.json();
});
const data = await fetch("https://swapi.py4e.com/api/people/1").then(
(res) => {
return res.json();
}
);

return data;
};
8 changes: 5 additions & 3 deletions src/09-promises.solution.2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ interface LukeSkywalker {
}

export const fetchLukeSkywalker = async () => {
const data = await fetch("https://swapi.dev/api/people/1").then((res) => {
return res.json();
});
const data = await fetch("https://swapi.py4e.com/api/people/1").then(
(res) => {
return res.json();
}
);

return data as LukeSkywalker;
};
2 changes: 1 addition & 1 deletion src/09-promises.solution.3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ interface LukeSkywalker {

export const fetchLukeSkywalker = async () => {
const data: LukeSkywalker = await fetch(
"https://swapi.dev/api/people/1"
"https://swapi.py4e.com/api/people/1"
).then((res) => {
return res.json();
});
Expand Down

0 comments on commit e430c2d

Please sign in to comment.