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