26 lines
750 B
TypeScript
26 lines
750 B
TypeScript
import type * as t from './types';
|
|
import { urls } from '@/config/urls';
|
|
import wretch from 'wretch';
|
|
|
|
const api = wretch(urls.URL_UIS)
|
|
.errorType('json')
|
|
.resolve(({ json }) => json());
|
|
|
|
export async function getData(params: t.Request) {
|
|
const url = `/${params.slug}?${new URLSearchParams(params.searchParams)}`;
|
|
|
|
return api.get(url).then((res) => res as t.ResponseGetData);
|
|
}
|
|
|
|
export async function getMetaData(params: t.Request) {
|
|
const url = `/${params.slug}/meta?${new URLSearchParams(params.searchParams)}`;
|
|
|
|
return api.get(url).then((res) => res as t.ResponseMetaData);
|
|
}
|
|
|
|
export async function getConfig(params: t.Request) {
|
|
const url = `/${params.slug}/config`;
|
|
|
|
return api.get(url).then((res) => res as t.ResponseConfig);
|
|
}
|