export function routeData({ params }: RouteDataArgs) {
return createServerData$(
async (key): Promise<PersonData> => {
let tries = 0;
try {
const d = await fetch(`http://localhost:4000/people/us/${key}`);
return await d.json();
} catch (e) {
console.error(e);
}
},
{
key: () => params.person,
}
);
}
export function routeData({ params }: RouteDataArgs) {
return createServerData$(
async (key): Promise<PersonData> => {
let tries = 0;
try {
const d = await fetch(`http://localhost:4000/people/us/${key}`);
return await d.json();
} catch (e) {
console.error(e);
}
},
{
key: () => params.person,
}
);
}