Spaces:
Running
Running
File size: 657 Bytes
6aa9047 7d88b7e 6aa9047 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
import Row from "./Row";
import { statusMessage } from "./store";
export const fetchRows = async (): Promise<Row[] | null> => {
statusMessage.set(`<span>Fetching data from https://dylanebert-research-tracker-backend.hf.space/data</span>`);
try {
const response = await fetch("/api/fetchRows");
const rows = await response.json();
statusMessage.reset();
return rows;
} catch (e) {
console.error(e);
statusMessage.set(
`<span style="color: red;">Error: Failed to fetch data from https://dylanebert-research-tracker-backend.hf.space/data</span>`
);
return null;
}
};
|