MCPcopy Create free account
hub / github.com/epicweb-dev/react-suspense / getShipImpl

Function getShipImpl

exercises/04.image/02.problem.error/utils.tsx:13–22  ·  view source on GitHub ↗
(name: string, delay?: number)

Source from the content-addressed store, hash-verified

11}
12
13async function getShipImpl(name: string, delay?: number) {
14 const searchParams = new URLSearchParams({ name })
15 if (delay) searchParams.set('delay', String(delay))
16 const response = await fetch(`api/get-ship?${searchParams.toString()}`)
17 if (!response.ok) {
18 return Promise.reject(new Error(await response.text()))
19 }
20 const ship = await response.json()
21 return ship as Ship
22}
23
24const imgCache = new Map<string, Promise<string>>()
25

Callers 1

getShipFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected