This repository has been archived on 2024-06-08. You can view files and clone it, but cannot push or open issues or pull requests.
SolarAgent/src/scripts/request.ts

15 lines
430 B
TypeScript
Raw Normal View History

const serviceMap: { [id: string]: string } = {
interactive: "https://co.solsynth.dev",
identity: "https://id.solsynth.dev"
}
export async function request(service: string, input: string, init?: RequestInit) {
const url = buildRequestUrl(service, input)
return await fetch(url, init)
}
export function buildRequestUrl(service: string, input: string) {
const prefix = serviceMap[service] ?? ""
return prefix + input
}