Spaces:
Running
Running
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; | |