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