Advertisement
Guest User

Untitled

a guest
Jun 29th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. import React from 'react';
  2. import { connect } from 'react-apollo';
  3. import gql from 'graphql-tag';
  4. import RLHeader from './RLHeader.jsx';
  5. import TabBar from './TabBar.jsx';
  6. import FirmRLTabContents from './FirmRLTabContents.jsx';
  7. import ItemList from './ItemList.jsx';
  8.  
  9. function FirmRequestList(props) {
  10. if(props.data.loading) {
  11. return <h3>loading...</h3>
  12. } else if(props.data.errors) {
  13. return <p>{JSON.stringify(props.data.errors)}</p>
  14. } else {
  15. return (
  16. <div>
  17. <RLHeader data={props.data}/>
  18. <TabBar routeParams={props.routeParams}/>
  19. <FirmRLTabContents routeParams={props.routeParams}/>
  20. <ItemList data={props.data}/>
  21. </div>
  22. );
  23. }
  24.  
  25. }
  26.  
  27. const query = gql`
  28. query getRequestList($id:ID!){
  29. requestList(id:$id) {
  30. id,
  31. name,
  32. dateDue,
  33. hideUntil,
  34. hideDateDue,
  35. status,
  36. engagement {
  37. id,
  38. name,
  39. client {
  40. id,
  41. name
  42. }
  43. },
  44. items {
  45. id,
  46. requestText,
  47. status,
  48. order
  49. }
  50. }
  51. }
  52. `;
  53.  
  54. const mapQueriesToProps = ({ ownProps, state }) => ({
  55. data: {
  56. query,
  57. variables: {
  58. id: ownProps.routeParams.id
  59. }
  60. }
  61. });
  62.  
  63. export default connect({ mapQueriesToProps })(FirmRequestList);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement