Browse Source

Dev

pull/937/head
Sergei Birukov 2 years ago
parent
commit
ab4cec1507
  1. 1
      .prettierignore
  2. 3
      src/.env
  3. 3
      src/.eslintrc.json
  4. 1
      src/config.js
  5. 11
      src/package-lock.json
  6. 5
      webui/src/services/api.js

1
.prettierignore

@ -0,0 +1 @@
**

3
src/.env

@ -0,0 +1,3 @@
WG_HOST=127.0.0.1
UI_TRAFFIC_STATS=true
UI_CHART_TYPE=2

3
src/.eslintrc.json

@ -6,6 +6,7 @@
"rules": { "rules": {
"consistent-return": "off", "consistent-return": "off",
"no-shadow": "off", "no-shadow": "off",
"max-len": "off" "max-len": "off",
"linebreak-style": "off"
} }
} }

1
src/config.js

@ -1,6 +1,7 @@
'use strict'; 'use strict';
const { release } = require('./package.json'); const { release } = require('./package.json');
require('dotenv').config(); // development
module.exports.RELEASE = release; module.exports.RELEASE = release;
module.exports.PORT = process.env.PORT || '51821'; module.exports.PORT = process.env.PORT || '51821';

11
src/package-lock.json

@ -1336,6 +1336,17 @@
"node": ">=6.0.0" "node": ">=6.0.0"
} }
}, },
"node_modules/dotenv": {
"version": "16.4.5",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.5.tgz",
"integrity": "sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg==",
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://dotenvx.com"
}
},
"node_modules/eastasianwidth": { "node_modules/eastasianwidth": {
"version": "0.2.0", "version": "0.2.0",
"resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz",

5
webui/src/services/api.js

@ -1,6 +1,8 @@
const SERVER = 'http://127.0.0.1:51821'
export default class API { export default class API {
async call({ method, path, body }) { async call({ method, path, body }) {
const res = await fetch(`./api${path}`, { const res = await fetch(`${SERVER}/api${path}`, {
method, method,
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
@ -11,6 +13,7 @@ export default class API {
if (res.status === 204) { if (res.status === 204) {
return undefined; return undefined;
} }
console.log(`${SERVER}/api${path}`);
const json = await res.json(); const json = await res.json();

Loading…
Cancel
Save