Guest User

Untitled

a guest
Jan 17th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. import React from 'react';
  2. import ReactDOM from 'react-dom';
  3. import ReactFlux from 'react-flux';
  4. import './index.css';
  5. import AppForm from './react-components/AppForm';
  6. import registerServiceWorker from './registerServiceWorker';
  7. import axios from 'axios';
  8.  
  9.  
  10. function getApplications() {
  11. return axios.get('/api/applications').then(x => x.data);
  12. }
  13.  
  14. function getMethodsData() {
  15. return axios.get('/api/applications/data', {
  16. params: {
  17. command: 'get-form-options',
  18. data: 'app-methods'
  19. }
  20. }).then(x => x.data);
  21. }
  22.  
  23. function getStatusesData() {
  24. return axios.get('/api/applications/data', {
  25. params: {
  26. command: 'get-form-options',
  27. data: 'app-statuses'
  28. }
  29. }).then(x => x.data);
  30. }
  31.  
  32. axios.all([getApplications(), getMethodsData(), getStatusesData()])
  33. .then(axios.spread((applications, methods, statuses) => {
  34. ReactDOM.render((
  35. <AppForm
  36. applications={applications}
  37. methods={methods}
  38. statuses={statuses}
  39. />
  40. ), document.getElementById('applist'));
  41. }));
  42.  
  43. //registerServiceWorker();
Add Comment
Please, Sign In to add comment