MCPcopy Create free account
hub / github.com/TanStack/router / fetchPhoto

Function fetchPhoto

examples/solid/location-masking/src/main.tsx:42–60  ·  view source on GitHub ↗
(photoId: string)

Source from the content-addressed store, hash-verified

40}
41
42const fetchPhoto = async (photoId: string) => {
43 console.info(`Fetching photo with id ${photoId}...`)
44 await new Promise((r) => setTimeout(r, 500))
45
46 // Simulate photo not found for invalid IDs
47 const photoIdNum = parseInt(photoId, 10)
48 if (isNaN(photoIdNum) || photoIdNum < 1 || photoIdNum > 10) {
49 throw new NotFoundError(`Photo with id "${photoId}" not found!`)
50 }
51
52 // Generate mock photo using picsum.photos
53 return {
54 id: photoId,
55 title: `Photo ${photoId}`,
56 url: `https://picsum.photos/600/400?random=${photoId}`,
57 thumbnailUrl: `https://picsum.photos/200/200?random=${photoId}`,
58 albumId: '1',
59 }
60}
61
62type PhotoModal = {
63 id: 'photo'

Callers 1

main.tsxFile · 0.70

Calls 1

infoMethod · 0.65

Tested by

no test coverage detected