summaryrefslogtreecommitdiffstats
path: root/frontend
diff options
context:
space:
mode:
Diffstat (limited to 'frontend')
-rw-r--r--frontend/README.md30
-rw-r--r--frontend/components/CreateItem.js3
-rw-r--r--frontend/components/Items.js19
-rw-r--r--frontend/components/Nav.js15
-rw-r--r--frontend/lib/withData.js5
5 files changed, 53 insertions, 19 deletions
diff --git a/frontend/README.md b/frontend/README.md
index 2bb72d8..8bd3242 100644
--- a/frontend/README.md
+++ b/frontend/README.md
@@ -7,4 +7,34 @@
I love this look and feel: http://wes.io/lxQe
https://www.youtube.com/watch?v=Y0ePh9OxSWo
+
+
+
+Descriptions for Images
+
+Nudie Belt
+
+Our accessories are all about genuine leather and denim. Belts, leather wallets cases, denim bags, Knitted hats and scarves in wool or organic cotton. For our leather accessories, we only use vegetable tanned leather. Leather accessories will acquire a patina and become more beautiful the longer you use them.
+
+Ultra Boost
+
+Ultraboost is the ultimate running shoe that delivers constant energy returns. The more you run the more energy you bring to your life.
+
+
+
+Black Hole
+
+The Black Hole Duffle is highly weather-resistant, and protects your gear from rough handling. The U-shaped lid allows quick access to the main compartment, while 2 zippered internal mesh pockets keep small items organized. A padded bottom panel adds structure and helps cushion the load when it gets tossed out of the vehicle or dropped from the pack mule.
+
+
+Yeti
+
+Keep your brie and bevies chilly. Heavy-duty insulation ensures cold temperatures persist. A self-stopping hinge and Yeti-tough details are durable. Non-slip rubber feet keep your drinks and snacks orderly through whitewater or rough approaches to the picnic site.
+
+
+
+
+
+
+
--> \ No newline at end of file
diff --git a/frontend/components/CreateItem.js b/frontend/components/CreateItem.js
index ece62b4..625bf89 100644
--- a/frontend/components/CreateItem.js
+++ b/frontend/components/CreateItem.js
@@ -5,6 +5,7 @@ import Error from './ErrorMessage';
import Form from './styles/Form';
import PropTypes from 'prop-types';
import Router from 'next/router';
+import formatMoney from '../lib/formatMoney';
class CreateItem extends Component {
state = {
@@ -76,7 +77,7 @@ class CreateItem extends Component {
/>
</label>
<label>
- Price
+ Price {this.state.price && formatMoney(this.state.price)}
<input
required
type="number"
diff --git a/frontend/components/Items.js b/frontend/components/Items.js
index 36491e6..d0e39e9 100644
--- a/frontend/components/Items.js
+++ b/frontend/components/Items.js
@@ -34,15 +34,30 @@ class ItemList extends React.Component {
<Pagination page={this.props.page} />
<Query
query={ALL_ITEMS_QUERY}
+ fetchPolicy="cache-and-network"
+ ssr={false}
variables={{
skip: this.props.page * perPage - perPage,
first: perPage,
}}
>
- {({ data, error, loading }) => {
+ {({ data, error, loading, variables, refetch }) => {
if (loading) return <div>Loading</div>;
if (error) return <div>Error</div>;
- return <Items key={this.props.page}>{data.items.map(item => <Item key={item.id} item={item} />)}</Items>;
+ return (
+ <Items key={this.props.page}>
+ {data.items.map(item => <Item key={item.id} item={item} />)}
+ <button
+ onClick={() => {
+ console.log('Refetching..');
+ console.log(refetch);
+ refetch();
+ }}
+ >
+ refetch
+ </button>
+ </Items>
+ );
}}
</Query>
<Pagination page={this.props.page} />
diff --git a/frontend/components/Nav.js b/frontend/components/Nav.js
index a51f7ca..7e65ec5 100644
--- a/frontend/components/Nav.js
+++ b/frontend/components/Nav.js
@@ -61,23 +61,12 @@ const StyledUl = styled.ul`
class Nav extends React.Component {
render() {
return (
- <Query query={CURRENT_USER_QUERY}>
- {({ data: { me }, refetch, loading, error }) => (
+ <Query query={CURRENT_USER_QUERY} ssr={false}>
+ {({ data: { me } }) => (
<StyledUl>
<Link prefetch href="/items">
<a>Shop</a>
</Link>
- <button
- onClick={() => {
- console.log('refetching!!');
- refetch()
- .then(console.log)
- .catch(console.error);
- console.log('done');
- }}
- >
- Refetch User
- </button>
<Link prefetch href="/add">
<a>Sell</a>
</Link>
diff --git a/frontend/lib/withData.js b/frontend/lib/withData.js
index 5a32fe3..1a152a3 100644
--- a/frontend/lib/withData.js
+++ b/frontend/lib/withData.js
@@ -7,11 +7,10 @@ export default withApollo({
client: new ApolloClient({
uri: 'http://localhost:4444',
// cache: new InMemoryCache().restore(initialState || {}),
- // ssrMode: !process.browser, // Disables forceFetch on the server (so queries are only run once)
+ ssrMode: !process.browser, // Disables forceFetch on the server (so queries are only run once)
request: operation => {
- console.log('hey');
+ console.log(operation);
if (typeof localStorage !== 'undefined' && localStorage.getItem('token')) {
- console.log('heyyy');
console.log(`Bearer ${localStorage.getItem('token')}`);
operation.setContext({
headers: {