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

Function getShip

exercises/02.dynamic/01.problem.cache/utils.tsx:14–23  ·  view source on GitHub ↗
(name: string, delay?: number)

Source from the content-addressed store, hash-verified

12
13// 🐨 rename this function to getShipImpl and remove the export
14export async function getShip(name: string, delay?: number) {
15 const searchParams = new URLSearchParams({ name })
16 if (delay) searchParams.set('delay', String(delay))
17 const response = await fetch(`api/get-ship?${searchParams.toString()}`)
18 if (!response.ok) {
19 return Promise.reject(new Error(await response.text()))
20 }
21 const ship = await response.json()
22 return ship as Ship
23}
24
25export function getImageUrlForShip(
26 shipName: string,

Callers 1

ShipDetailsFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected