MCPcopy Create free account
hub / github.com/Devographics/Monorepo / reload

Function reload

surveyadmin/src/scripts/reloadAPI.ts:11–31  ·  view source on GitHub ↗
(path, args: { target?: Target })

Source from the content-addressed store, hash-verified

9
10type Target = "production" | "staging" | "local";
11const reload = async (path, args: { target?: Target }) => {
12 const { target } = args;
13 const apiUrl =
14 target === "production"
15 ? process.env.API_URL_PRODUCTION
16 : process.env.API_URL;
17 if (!apiUrl)
18 throw new Error(
19 `API_URL or API_URL_PRODUCTION is not defined, target is: ${target}`
20 );
21 const url = getUrl(path, apiUrl);
22 console.log("// reload");
23 console.log(path);
24 console.log(url);
25 const response = await fetch(url, {
26 method: "GET",
27 });
28 const result = await response.text();
29 console.log(result);
30 return { result, url };
31};
32
33export const reloadAPISurveys = async (args) => {
34 return await reload("reinitialize-surveys", args);

Callers 3

reloadAPISurveysFunction · 0.85
reloadAPILocalesFunction · 0.85
reloadAPIEntitiesFunction · 0.85

Calls 1

getUrlFunction · 0.70

Tested by

no test coverage detected