Update: config file for front-end
This commit is contained in:
parent
46ec04029b
commit
3433a467ad
3
public/config.js
Normal file
3
public/config.js
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
var configs = {
|
||||||
|
"aUrl": "https://localhost:8080"
|
||||||
|
};
|
@ -24,6 +24,7 @@
|
|||||||
<body >
|
<body >
|
||||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||||
<div id="root"></div>
|
<div id="root"></div>
|
||||||
|
<script src="config.js"></script>
|
||||||
<!-- <div id="okta-login-container"></div> -->
|
<!-- <div id="okta-login-container"></div> -->
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
|
@ -5,7 +5,7 @@ import Manager from './components/Manager';
|
|||||||
import Navigationbar from './components/Navigationbar';
|
import Navigationbar from './components/Navigationbar';
|
||||||
import { CookiesProvider } from 'react-cookie';
|
import { CookiesProvider } from 'react-cookie';
|
||||||
import TaskList from './components/TaskList';
|
import TaskList from './components/TaskList';
|
||||||
import Simulator from './components/Simulator';
|
|
||||||
|
|
||||||
//import Final_login from './components/Final_login';
|
//import Final_login from './components/Final_login';
|
||||||
|
|
||||||
@ -20,7 +20,7 @@ class Routing extends Component {
|
|||||||
*/}
|
*/}
|
||||||
<Route path="/progress" component={Manager}/>
|
<Route path="/progress" component={Manager}/>
|
||||||
<Route path="/tasks" component={TaskList}/>
|
<Route path="/tasks" component={TaskList}/>
|
||||||
<Route path="/simulator" component={Simulator}/>
|
|
||||||
<Route path="/" exact= {true} component={App}/>
|
<Route path="/" exact= {true} component={App}/>
|
||||||
</switch>
|
</switch>
|
||||||
</div>
|
</div>
|
||||||
|
@ -12,6 +12,7 @@ import axios from 'axios';
|
|||||||
import LoadingOverlay from 'react-loading-overlay';
|
import LoadingOverlay from 'react-loading-overlay';
|
||||||
import { thisExpression } from '@babel/types';
|
import { thisExpression } from '@babel/types';
|
||||||
|
|
||||||
|
|
||||||
class App extends Component{
|
class App extends Component{
|
||||||
state = {
|
state = {
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
@ -19,7 +20,8 @@ class App extends Component{
|
|||||||
user: undefined,
|
user: undefined,
|
||||||
launch: false,
|
launch: false,
|
||||||
isNavbar: false,
|
isNavbar: false,
|
||||||
url: ""
|
url: "",
|
||||||
|
backend_url: ""
|
||||||
};
|
};
|
||||||
|
|
||||||
constructor(props){
|
constructor(props){
|
||||||
@ -28,12 +30,10 @@ class App extends Component{
|
|||||||
console.log(cookies);
|
console.log(cookies);
|
||||||
this.state.csrfToken = cookies.get('XSRF-TOKEN');
|
this.state.csrfToken = cookies.get('XSRF-TOKEN');
|
||||||
console.log(this.state.csrfToken);
|
console.log(this.state.csrfToken);
|
||||||
this.local = "localhost:8080";
|
|
||||||
this.prod = "174.138.41.124";
|
|
||||||
this.status = "local"
|
this.status = "local"
|
||||||
if (this.status === "local") {
|
this.ip = window.configs.aUrl;
|
||||||
this.ip = this.local;
|
|
||||||
}
|
|
||||||
this.simulatorWindow = null;
|
this.simulatorWindow = null;
|
||||||
this.shellWindow = null;
|
this.shellWindow = null;
|
||||||
this.routeLogin = this.routeLogin.bind(this);
|
this.routeLogin = this.routeLogin.bind(this);
|
||||||
@ -50,7 +50,8 @@ class App extends Component{
|
|||||||
}
|
}
|
||||||
|
|
||||||
async componentDidMount() {
|
async componentDidMount() {
|
||||||
const response = await fetch(`http://${this.ip}/api/user`, {credentials: 'include'});
|
console.log(this.state.backend_url)
|
||||||
|
const response = await fetch(`${this.ip}/api/user`, {credentials: 'include'});
|
||||||
console.log(response.ok);
|
console.log(response.ok);
|
||||||
const body = await response.text();
|
const body = await response.text();
|
||||||
if (body === '') {
|
if (body === '') {
|
||||||
@ -69,7 +70,7 @@ class App extends Component{
|
|||||||
|
|
||||||
login() {
|
login() {
|
||||||
console.log(window.location)
|
console.log(window.location)
|
||||||
window.location.href = `//${this.ip}/task/list`;
|
window.location.href = `${this.ip}/task/list`;
|
||||||
}
|
}
|
||||||
wait(ms){
|
wait(ms){
|
||||||
var start = new Date().getTime();
|
var start = new Date().getTime();
|
||||||
|
Loading…
Reference in New Issue
Block a user