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": {
"consistent-return": "off",
"no-shadow": "off",
"max-len": "off"
"max-len": "off",
"linebreak-style": "off"
}
}

1
src/config.js

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

11
src/package-lock.json

@ -1336,6 +1336,17 @@
"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": {
"version": "0.2.0",
"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 {
async call({ method, path, body }) {
const res = await fetch(`./api${path}`, {
const res = await fetch(`${SERVER}/api${path}`, {
method,
headers: {
'Content-Type': 'application/json',
@ -11,6 +13,7 @@ export default class API {
if (res.status === 204) {
return undefined;
}
console.log(`${SERVER}/api${path}`);
const json = await res.json();

Loading…
Cancel
Save