30 lines
1.1 KiB
TypeScript
30 lines
1.1 KiB
TypeScript
export async function retrieveAvailableApplications(data: any): Promise<string[]> {
|
|
try {
|
|
const response = await fetch("http://localhost:3000/api/menu", {
|
|
method: "POST",
|
|
headers: { "Content-Type": "application/json", "no-cache": "true" },
|
|
body: JSON.stringify({ ...data }),
|
|
})
|
|
if (response.status !== 200) {
|
|
throw new Error("Failed to retrieve available applications");
|
|
}
|
|
const result = await response.json();
|
|
return result.data
|
|
} catch (error) { throw error }
|
|
}
|
|
|
|
export async function retrievePageToRender(data: any): Promise<string> {
|
|
try {
|
|
const response = await fetch("http://localhost:3000/api/pages", {
|
|
method: "POST",
|
|
headers: { "Content-Type": "application/json", "no-cache": "true" },
|
|
body: JSON.stringify({ ...data }),
|
|
})
|
|
if (response.status !== 200) {
|
|
throw new Error("Failed to retrieve page to render");
|
|
}
|
|
const result = await response.json();
|
|
return result.data
|
|
} catch (error) { throw error }
|
|
}
|