Spaces:
Running
Running
File size: 431 Bytes
0b598b9 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
class API {
static async fetchIndex(): Promise<string> {
const response = await fetch("/");
if (!response.ok) throw new Error("Failed to fetch index.html");
return response.text();
}
static async fetchStaticFile(path: string): Promise<string> {
const response = await fetch(`/${path}`);
if (!response.ok) throw new Error(`Failed to fetch ${path}`);
return response.text();
}
}
export default API;
|