Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/component/modals/ContributeDetails.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { useState } from 'react';
import { toast } from 'react-toastify';
import axios from 'axios';
import { API_BASE_URL } from '../../serverCon/config';
import Modal from './ParentModal';
import { actionType as T } from '../../reducer';
import './contributeDetails.css';
Expand All @@ -24,7 +25,7 @@ const ContributeDetails = ({ superState, dispatcher }) => {
const id = toast.loading('Processing your Request.Please wait...');
try {
e.preventDefault();
const result = await axios.post('http://127.0.0.1:5000/contribute', {
const result = await axios.post(`${API_BASE_URL}/contribute`, {
study,
auth,
desc,
Expand Down
15 changes: 8 additions & 7 deletions src/graph-builder/graph-core/6-server.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { toast } from 'react-toastify';
import Axios from 'axios';
import { actionType as T } from '../../reducer';
import { API_BASE_URL } from '../../serverCon/config';
import GraphLoadSave from './5-load-save';
// import {
// postGraph, updateGraph, forceUpdateGraph, getGraph, getGraphWithHashCheck,
Expand Down Expand Up @@ -73,7 +74,7 @@ class GraphServer extends GraphLoadSave {
autoClose: false,
});
this.dispatcher({ type: T.SET_LOGS, payload: false });
Axios.post(`http://127.0.0.1:5000/build/${this.superState.uploadedDirName}?fetch=${this.superState.graphs[this.superState.curGraphIndex].fileName.split('.')[0]}&unlock=${this.superState.unlockCheck}&docker=${this.superState.dockerCheck}&maxtime=${this.superState.maxTime}&params=${this.superState.params}&octave=${this.superState.octave}`)
Axios.post(`${API_BASE_URL}/build/${this.superState.uploadedDirName}?fetch=${this.superState.graphs[this.superState.curGraphIndex].fileName.split('.')[0]}&unlock=${this.superState.unlockCheck}&docker=${this.superState.dockerCheck}&maxtime=${this.superState.maxTime}&params=${this.superState.params}&octave=${this.superState.octave}`)
.then((res) => { // eslint-disable-next-line
toast.success(res.data['message']);
this.dispatcher({
Expand All @@ -98,7 +99,7 @@ class GraphServer extends GraphLoadSave {
autoClose: false,
});
this.dispatcher({ type: T.SET_LOGS, payload: false });
Axios.post(`http://127.0.0.1:5000/debug/${this.superState.graphs[this.superState.curGraphIndex].fileName.split('.')[0]}`)
Axios.post(`${API_BASE_URL}/debug/${this.superState.graphs[this.superState.curGraphIndex].fileName.split('.')[0]}`)
.then((res) => { // eslint-disable-next-line
toast.success(res.data['message'])
this.dispatcher({
Expand All @@ -122,7 +123,7 @@ class GraphServer extends GraphLoadSave {
autoClose: false,
});
this.dispatcher({ type: T.SET_LOGS, payload: false });
Axios.post(`http://127.0.0.1:5000/run/${this.superState.graphs[this.superState.curGraphIndex].fileName.split('.')[0]}`)
Axios.post(`${API_BASE_URL}/run/${this.superState.graphs[this.superState.curGraphIndex].fileName.split('.')[0]}`)
.then((res) => { // eslint-disable-next-line
toast.success(res.data['message'])
this.dispatcher({
Expand All @@ -146,7 +147,7 @@ class GraphServer extends GraphLoadSave {
autoClose: false,
});
this.dispatcher({ type: T.SET_LOGS, payload: false });
Axios.post(`http://127.0.0.1:5000/clear/${this.superState.graphs[this.superState.curGraphIndex].fileName.split('.')[0]}
Axios.post(`${API_BASE_URL}/clear/${this.superState.graphs[this.superState.curGraphIndex].fileName.split('.')[0]}
?unlock=${this.superState.unlockCheck}&maxtime=${this.superState.maxTime}&params=${this.superState.params}`)
.then((res) => { // eslint-disable-next-line
toast.success(res.data['message']);
Expand All @@ -171,7 +172,7 @@ class GraphServer extends GraphLoadSave {
autoClose: false,
});
this.dispatcher({ type: T.SET_LOGS, payload: false });
Axios.post(`http://127.0.0.1:5000/stop/${this.superState.graphs[this.superState.curGraphIndex].fileName.split('.')[0]}`)
Axios.post(`${API_BASE_URL}/stop/${this.superState.graphs[this.superState.curGraphIndex].fileName.split('.')[0]}`)
.then((res) => { // eslint-disable-next-line
toast.success(res.data['message'])
this.dispatcher({
Expand All @@ -195,7 +196,7 @@ class GraphServer extends GraphLoadSave {
autoClose: false,
});
this.dispatcher({ type: T.SET_LOGS, payload: false });
Axios.delete(`http://127.0.0.1:5000/destroy/${this.superState.graphs[this.superState.curGraphIndex].fileName.split('.')[0]}`)
Axios.delete(`${API_BASE_URL}/destroy/${this.superState.graphs[this.superState.curGraphIndex].fileName.split('.')[0]}`)
.then((res) => { // eslint-disable-next-line
toast.success(res.data['message'])
this.dispatcher({
Expand All @@ -219,7 +220,7 @@ class GraphServer extends GraphLoadSave {
autoClose: false,
});
// this.dispatcher({ type: T.SET_LOGS, payload: false });
Axios.post(`http://127.0.0.1:5000/library/${this.superState.uploadedDirName}?filename=${fileName}&path=${this.superState.library}`)
Axios.post(`${API_BASE_URL}/library/${this.superState.uploadedDirName}?filename=${fileName}&path=${this.superState.library}`)
.then((res) => { // eslint-disable-next-line
toast.info(res.data['message'])
toast.dismiss(toastId);
Expand Down
2 changes: 2 additions & 0 deletions src/serverCon/config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
export const API_BASE_URL = process.env.REACT_APP_API_BASE_URL || 'http://127.0.0.1:5000';

export default {
baseURL: 'http://localhost:8000/',
getGraph: (id) => `workflow/${id}`,
Expand Down