Skip to content

Commit 3be3442

Browse files
committed
Use .env to build predict URL
1 parent e8cc42f commit 3be3442

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

Track 4_ReactJS_Web Development/Project/Frontend/hrc-dashboard/.env.local

+2
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@ HOST = 0.0.0.0
22
PORT = 4848
33
REACT_APP_API_SERVER = 192.168.0.134
44
REACT_APP_API_SERVER_PORT = 280
5+
REACT_APP_FLASK_SERVER = 192.168.0.134
6+
REACT_APP_FLASK_SERVER_PORT = 5000
57
GITHUB_SECRET = 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

Track 4_ReactJS_Web Development/Project/Frontend/hrc-dashboard/src/utils/api/doPrediction.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
import { post } from 'axios';
22

3+
const { REACT_APP_FLASK_SERVER, REACT_APP_FLASK_SERVER_PORT } = process.env;
4+
35
const doPrediction = async (payload) => {
6+
const URL = `http://${REACT_APP_FLASK_SERVER || '192.168.0.134'}:${
7+
REACT_APP_FLASK_SERVER_PORT || '5000'
8+
}`;
49
try {
5-
const { status, data } = await post('http://192.168.0.134:5000/get_prediction', {
10+
const { status, data } = await post(`http://${URL}/get_prediction`, {
611
data: payload,
712
});
813

0 commit comments

Comments
 (0)