import type * as t from './types'; import { urls } from '@/config/urls'; import wretch from 'wretch'; const api = wretch(urls.URL_UIS).errorType('json'); type CreateUrl = (path: string) => string; export async function getData(createUrl: CreateUrl) { const url = createUrl(''); return api .get(url) .res((cb) => cb.json()) .then((res) => res); } export async function getMetaData(createUrl: CreateUrl) { const url = createUrl('/meta'); return api .get(url) .res((res) => res.json()) .then((res) => res); } export async function getConfig(createUrl: CreateUrl) { const url = createUrl('/config'); return api .get(url) .res((res) => res.json()) .then((res) => res); } export async function getConditions(createUrl: CreateUrl) { const url = createUrl('/conditions'); return api .get(url) .res((res) => res.text()) .then((res) => res); }