Updated loading states and error states accross app
This commit is contained in:
@@ -10,7 +10,9 @@ async function fetchSighting(
|
||||
url: string | undefined,
|
||||
ref: number
|
||||
): Promise<SightingType> {
|
||||
const res = await fetch(`${url}${ref}`);
|
||||
const res = await fetch(`${url}${ref}`, {
|
||||
signal: AbortSignal.timeout(5000),
|
||||
});
|
||||
if (!res.ok) throw new Error(String(res.status));
|
||||
return res.json();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user