Skip to content

Commit 77481be

Browse files
committed
fix(examples): SWAPI provider with search
1 parent 2640557 commit 77481be

File tree

1 file changed

+5
-5
lines changed
  • packages/docs/src/routes/examples/apps/reactivity/auto-complete

1 file changed

+5
-5
lines changed

packages/docs/src/routes/examples/apps/reactivity/auto-complete/app.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default component$(() => {
77
<br />
88
<br />
99
Go ahead, search for Star Wars characters such as "Luke Skywalker", it uses the{' '}
10-
<a href="https://swapi-node.vercel.app/">Star Wars API</a>:
10+
<a href="https://swapi.py4e.com/">Star Wars API</a>:
1111
<br />
1212
<br />
1313
<AutoComplete></AutoComplete>
@@ -68,16 +68,16 @@ export const SuggestionsListComponent = (props: { state: IState }) => {
6868
};
6969

7070
const getPeople = (searchInput: string, controller?: AbortController): Promise<string[]> =>
71-
fetch(`https://swapi-node.vercel.app/api/people/?search=${searchInput}`, {
71+
fetch(`https://swapi.py4e.com/api/people/?search=${searchInput}`, {
7272
signal: controller?.signal,
7373
})
7474
.then((response) => {
7575
return response.json();
7676
})
7777
.then((parsedResponse) => {
78-
debugger;
79-
return parsedResponse.results.map((people: any) => people.fields.name);
80-
});
78+
return parsedResponse.results.map((people: { name: string }) => people.name);
79+
})
80+
.catch((e) => console.error('fetch failed', e));
8181

8282
function debounce<F extends (...args: any) => any>(fn: F, delay = 500) {
8383
let timeoutId: ReturnType<typeof setTimeout>;

0 commit comments

Comments
 (0)