Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
TsotosA committed Feb 15, 2023
1 parent 2d9aa10 commit bac7515
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions web/ui-react/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
REACT_APP_API_ROOT=http://localhost:1323
Empty file removed web/ui-react/.env.development
Empty file.
1 change: 1 addition & 0 deletions web/ui-react/.env.production
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
REACT_APP_API_ROOT=http://192.168.2.154:1323
4 changes: 2 additions & 2 deletions web/ui-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build && mv build '../ui-serve/'",
"build:dev": "dotenv -e .env.development react-scripts build",
"build": "set NODE_ENV=production && react-scripts build && mv build '../ui-serve/'",
"build:dev": "set NODE_ENV=development && dotenv -e .env.production react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
Expand Down
6 changes: 3 additions & 3 deletions web/ui-react/src/service.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
export const fetchConfiguration = async () => {
const res = await fetch('http://localhost:1323/api/config')
const res = await fetch(`${process.env.REACT_APP_API_ROOT}/api/config`)
return res.json()
}

export const saveConfiguration = async (conf: any) => {
const res = await fetch('http://localhost:1323/api/config', {
const res = await fetch(`${process.env.REACT_APP_API_ROOT}/api/config`, {
method: "POST",
headers: {
'Content-Type': 'application/json'
Expand All @@ -15,6 +15,6 @@ export const saveConfiguration = async (conf: any) => {
}

export const fetchLogs = async (nItems: number, grepFor?: string) => {
const res = await fetch(`http://localhost:1323/api/log?nItems=${nItems}&grepFor=${grepFor}`)
const res = await fetch(`${process.env.REACT_APP_API_ROOT}/api/log?nItems=${nItems}&grepFor=${grepFor}`)
return await res.text();
}

0 comments on commit bac7515

Please sign in to comment.