From 41a86494f3caea96dd4ed32733310783e47b429d Mon Sep 17 00:00:00 2001 From: Wes Bos Date: Thu, 5 Apr 2018 16:52:40 -0400 Subject: refactor --- backend/package.json | 26 +-- backend/src/resolvers/Query.js | 3 +- frontend/components/CreateItem.js | 21 ++- frontend/components/DeleteItem.js | 6 +- frontend/components/Item.js | 4 +- frontend/components/Items.js | 15 +- frontend/components/Nav.js | 4 + frontend/components/Pagination.js | 2 +- frontend/components/Search.js | 118 ++++++------ frontend/components/Signin.js | 3 +- frontend/components/Signout.js | 1 + frontend/package-lock.json | 386 ++++++++++---------------------------- frontend/package.json | 14 +- frontend/queries/index.js | 16 +- 14 files changed, 226 insertions(+), 393 deletions(-) diff --git a/backend/package.json b/backend/package.json index 1fdbc3a..a15f813 100644 --- a/backend/package.json +++ b/backend/package.json @@ -9,24 +9,24 @@ }, "dependencies": { "bcryptjs": "2.4.3", - "graphql": "^0.12.3", - "graphql-yoga": "1.2.4", - "jsonwebtoken": "8.1.1", - "nodemailer": "^4.4.2", - "prisma-binding": "1.5.7", + "graphql": "^0.13.2", + "graphql-yoga": "1.7.1", + "jsonwebtoken": "8.2.1", + "nodemailer": "^4.6.4", + "prisma-binding": "1.5.16", "react-debounce-input": "^3.2.0", - "stripe": "^5.4.0" + "stripe": "^5.8.0" }, "devDependencies": { "babel-preset-env": "^1.6.1", - "chalk": "^2.3.0", - "dotenv": "5.0.0", - "graphql-cli": "2.14.0", - "graphql-request": "^1.4.1", - "jest-cli": "^22.1.4", - "nodemon": "1.14.12", + "chalk": "^2.3.2", + "dotenv": "5.0.1", + "graphql-cli": "2.15.8", + "graphql-request": "^1.5.1", + "jest-cli": "^22.4.3", + "nodemon": "1.17.3", "npm-run-all": "4.1.2", - "prisma": "1.2.0" + "prisma": "1.5.3" }, "license": "MIT", "repository": { diff --git a/backend/src/resolvers/Query.js b/backend/src/resolvers/Query.js index e69a671..a34b484 100644 --- a/backend/src/resolvers/Query.js +++ b/backend/src/resolvers/Query.js @@ -3,6 +3,7 @@ const { forwardTo } = require('prisma-binding'); const Query = { items(parent, args, ctx, info) { + console.log('ITEMS!'); // check auth return ctx.db.query.items({ ...args }, info); }, @@ -36,7 +37,7 @@ const Query = { }, async users(parent, args, ctx, info) { - console.log('TODO: check their permissions'); + // TODO Permissions const userId = getUserId(ctx); return ctx.db.query.users({}, info); }, diff --git a/frontend/components/CreateItem.js b/frontend/components/CreateItem.js index 625bf89..49f2f8f 100644 --- a/frontend/components/CreateItem.js +++ b/frontend/components/CreateItem.js @@ -1,6 +1,6 @@ import React, { Component } from 'react'; import { Mutation } from 'react-apollo'; -import { CREATE_ITEM_MUTATION } from '../queries'; +import { CREATE_ITEM_MUTATION, ALL_ITEMS_QUERY } from '../queries'; import Error from './ErrorMessage'; import Form from './styles/Form'; import PropTypes from 'prop-types'; @@ -42,9 +42,22 @@ class CreateItem extends Component { }); }; + // TODO: Problem here - if I refetch page 1, page 2 to infinity are still out of date. I need to refetch all the pages somehow? without @connection render() { return ( - + {(createItem, { loading, error }) => (
{ @@ -62,7 +75,9 @@ class CreateItem extends Component {