fixed type errors

This commit is contained in:
2025-09-16 14:20:38 +01:00
parent c506c395e6
commit b98e3ed85d
21 changed files with 161 additions and 130 deletions

View File

@@ -1,19 +1,16 @@
import { useEffect, useRef, useState } from "react";
import type { SightingType, SightingWidgetType } from "../types/types";
import type { SightingType } from "../types/types";
async function fetchSighting(
url: string,
ref: number
): Promise<SightingWidgetType> {
async function fetchSighting(url: string, ref: number): Promise<SightingType> {
const res = await fetch(`${url}${ref}`);
if (!res.ok) throw new Error(String(res.status));
return await res.json();
}
export function useSightingFeed(url: string) {
const [sightings, setSightings] = useState<SightingWidgetType[]>([]);
const [sightings, setSightings] = useState<SightingType[]>([]);
const [selectedRef, setSelectedRef] = useState<number | null>(null);
const [mostRecent, setMostRecent] = useState<SightingWidgetType | null>(null);
const [mostRecent, setMostRecent] = useState<SightingType | null>(null);
const [selectedSighting, setSelectedSighting] = useState<SightingType | null>(
null
);