page-proxy/src/module/query/get-router.ts
2024-10-15 18:08:02 +08:00

41 lines
938 B
TypeScript

import { useConfig } from '@abearxiong/use-config';
const { resources, api } = useConfig<{
resources: string;
api: { host: string };
}>();
export const fetchTest = async (id: string) => {
const fetchUrl = 'http://' + api.host + '/api/router';
const fetchRes = await fetch(fetchUrl, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
path: 'user-app',
key: 'test',
id: id,
}),
}).then((res) => res.json());
return fetchRes;
};
export const fetchDomain = async (domain: string) => {
const fetchUrl = 'http://' + api.host + '/api/router';
const fetchRes = await fetch(fetchUrl, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
path: 'app',
key: 'getDomainApp',
data: {
domain,
},
}),
}).then((res) => res.json());
return fetchRes;
};