mirror of
https://github.com/lainbo/component-party.git
synced 2026-04-05 04:59:02 +08:00
15 lines
353 B
JavaScript
15 lines
353 B
JavaScript
import { Task } from "@lit/task";
|
|
|
|
export function createFetchUsersTask(element) {
|
|
return new Task(element, {
|
|
task: async () => {
|
|
const response = await fetch("https://randomuser.me/api/?results=3");
|
|
if (!response.ok) {
|
|
throw new Error(response.status);
|
|
}
|
|
return response.json();
|
|
},
|
|
args: () => [],
|
|
});
|
|
}
|