Skip to content

Instantly share code, notes, and snippets.

@l0gicgate
Last active January 9, 2018 00:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save l0gicgate/f522a26b2a2a86c8419da4b331d24566 to your computer and use it in GitHub Desktop.
Save l0gicgate/f522a26b2a2a86c8419da4b331d24566 to your computer and use it in GitHub Desktop.
import React from 'react';
import ReactDOM from 'react-dom';
import ReactFlux from 'react-flux';
import './index.css';
import AppForm from './react-components/AppForm';
import registerServiceWorker from './registerServiceWorker';
import axios from 'axios';
function getApplications() {
return axios.get('/api/applications').then(x => x.data);
}
function getMethodsData() {
return axios.get('/api/applications/data', {
params: {
command: 'get-form-options',
data: 'app-methods'
}
}).then(x => x.data);
}
function getStatusesData() {
return axios.get('/api/applications/data', {
params: {
command: 'get-form-options',
data: 'app-statuses'
}
}).then(x => x.data);
}
axios.all([getApplications(), getMethodsData(), getStatusesData()])
.then(axios.spread((applications, methods, statuses) => {
ReactDOM.render((
<AppForm
applications={applications}
methods={methods}
statuses={statuses}
/>
), document.getElementById('applist'));
}));
//registerServiceWorker();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment