diff options
| author | Wes Bos <wesbos@gmail.com> | 2018-05-24 15:19:21 -0400 |
|---|---|---|
| committer | Wes Bos <wesbos@gmail.com> | 2018-05-24 15:19:21 -0400 |
| commit | 072eca0e5038a7755ca9b2c94dfe1a0c3f110968 (patch) | |
| tree | a6c54e1503baf665ad0eeaeaad6d2a2b7ba3ba39 /frontend/components/Items.js | |
| parent | b294a6fa500b165aae86afbad5fce49a02314b0d (diff) | |
colocate queries and components
Diffstat (limited to 'frontend/components/Items.js')
| -rw-r--r-- | frontend/components/Items.js | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/frontend/components/Items.js b/frontend/components/Items.js index 618cc84..394f16d 100644 --- a/frontend/components/Items.js +++ b/frontend/components/Items.js @@ -2,11 +2,25 @@ import React from 'react'; import { Query } from 'react-apollo'; import styled from 'styled-components'; import PropTypes from 'prop-types'; +import gql from 'graphql-tag'; import Pagination from './Pagination'; import Item from './Item'; import LoadingItem from './LoadingItem'; import { perPage } from '../config'; -import { ALL_ITEMS_QUERY } from '../queries/queries.graphql'; + +const ALL_ITEMS_QUERY = gql` + query ALL_ITEMS_QUERY($skip: Int = 0, $first: Int = 4) { + items(orderBy: createdAt_DESC, first: $first, skip: $skip) { + __typename + id + title + price + description + image + largeImage + } + } +`; const Items = styled.div` display: grid; @@ -57,3 +71,4 @@ class ItemList extends React.Component { } export default ItemList; +export { ALL_ITEMS_QUERY }; |
