From d9d81925299aa787cbdb815cb4b06e17a412b40c Mon Sep 17 00:00:00 2001
From: Jules Laplace <jules@okfoc.us>
Date: Mon, 20 Mar 2017 01:59:47 +0100
Subject: filter by date

---
 client/components/MealList.jsx | 17 ++++-------------
 1 file changed, 4 insertions(+), 13 deletions(-)

(limited to 'client/components/MealList.jsx')

diff --git a/client/components/MealList.jsx b/client/components/MealList.jsx
index 53c8289..5b0bc1b 100644
--- a/client/components/MealList.jsx
+++ b/client/components/MealList.jsx
@@ -19,18 +19,6 @@ export default class MealList extends React.Component {
     this.handleUpdate = this.handleUpdate.bind(this)
     this.handleDelete = this.handleDelete.bind(this)
     this.pickMeal = this.pickMeal.bind(this)
-
-    client.service('meals').find({
-      query: {
-        userid: props.user.id,
-        '$sort': { 'date': '-1' },
-        token: client.get('token'),
-      },
-    }).then((data) => {
-      this.setState(data)
-    }).catch((error) => {
-      console.error(error)
-    })
   }
   handleCreate(meal) {
     const meals = this.state.data.slice()
@@ -79,7 +67,10 @@ export default class MealList extends React.Component {
           onCreate={(meal) => { this.handleCreate(meal) }}
           onUpdate={(meal) => { this.handleUpdate(meal) }}
         />
-        <MealFilter />
+        <MealFilter user={this.props.user}
+          ref={(mealFilter) => { this.mealFilter = mealFilter }}
+          onChange={(meals) => { this.setState({ data: meals }) }}
+        />
         <div>
           {items}
         </div>
-- 
cgit v1.2.3-70-g09d2

