API Console Desk
Filterable list with URLSearchParams, abort on re-search, and UI states.
Capstone: build the query with URLSearchParams, abort the
previous fetch when searching again, and show loading / empty / error /
data. Uses JSONPlaceholder posts.
URL appears here.
State: idle
Important JavaScript
if (controller) {
controller.abort();
}
controller = new AbortController();
const url = new URL(BASE);
url.searchParams.set("userId", String(userId));
const response = await fetch(url, { signal: controller.signal });