|
1 | 1 | const isProduction = process.env.NODE_ENV === 'production';
|
2 | 2 | const mockPath = `${process.env.PUBLIC_URL}/__mocks__/apiRequests`;
|
3 | 3 |
|
| 4 | +const { |
| 5 | + location: { hostname: domain }, |
| 6 | +} = window; |
| 7 | + |
4 | 8 | export const getAppData = isProduction
|
5 |
| - ? 'localhost/getAppData' |
| 9 | + ? `//${domain}/get-app-data.php` |
6 | 10 | : `${mockPath}/getAppData.json`;
|
7 | 11 |
|
8 | 12 | export const getDockerData = isProduction
|
9 |
| - ? 'localhost/getDockerData' |
| 13 | + ? `//${domain}/get-docker-data.php` |
10 | 14 | : `${mockPath}/getDockerData.json`;
|
11 | 15 |
|
12 | 16 | export const getMails = isProduction
|
13 |
| - ? 'localhost/getMails' |
| 17 | + ? `//${domain}/get-mails.php` |
14 | 18 | : `${mockPath}/getMails.json`;
|
15 | 19 |
|
16 | 20 | export const makeGetContainerData = (id: string) =>
|
17 | 21 | isProduction
|
18 |
| - ? `localhost/getContainerData/${id}` |
| 22 | + ? `//${domain}/get-container-data.php?id=${id}` |
19 | 23 | : `${mockPath}/containerData/${id}.json`;
|
20 | 24 |
|
21 | 25 | export const makeGetToolsData = (id: string) =>
|
22 | 26 | isProduction
|
23 |
| - ? `localhost/getToolsData/${id}` |
| 27 | + ? `//${domain}/get-tools.php?id=${id}` |
24 | 28 | : `${mockPath}/tools/${id}.json`;
|
25 | 29 |
|
26 | 30 | export const getVhosts = isProduction
|
27 |
| - ? 'localhost/getVhosts' |
| 31 | + ? `//${domain}/get-vhosts.php` |
28 | 32 | : `${mockPath}/getVhosts.json`;
|
29 | 33 |
|
30 | 34 | export const makeGetVhostDirectory = (id: string) =>
|
31 | 35 | isProduction
|
32 |
| - ? `localhost/vhosts/directory/${id}` |
| 36 | + ? `//${domain}/get-vhost-dir.php?id=${id}` |
33 | 37 | : `${mockPath}/vhosts/directory/${id}.json`;
|
34 | 38 |
|
35 |
| -export const makeGetVhostsDomain = (id: string) => |
| 39 | +export const makeGetVhostsDomain = (id: string, tld_suffix: string) => |
36 | 40 | isProduction
|
37 |
| - ? `localhost/vhosts/domain/${id}` |
| 41 | + ? `//${id}.${tld_suffix}/devilbox-api/status.json` |
38 | 42 | : `${mockPath}/vhosts/domain/${id}.json`;
|
0 commit comments