From 33cb6f5f09c1843d8b7369933133447f409f5e89 Mon Sep 17 00:00:00 2001 From: KevinMidboe Date: Tue, 9 Jan 2018 16:03:11 +0100 Subject: [PATCH] In admin we added a updatehandler so that a child can update this parent element. Also added our new sidebar for filtering our requested items by query and category. --- client/app/components/admin/Admin.jsx | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/client/app/components/admin/Admin.jsx b/client/app/components/admin/Admin.jsx index 50047b1..d2faeef 100644 --- a/client/app/components/admin/Admin.jsx +++ b/client/app/components/admin/Admin.jsx @@ -20,10 +20,16 @@ class AdminComponent extends React.Component { this.state = { requested_objects: '', } + + this.updateHandler = this.updateHandler.bind(this) } // Fetches all requested elements and updates the state with response componentWillMount() { + this.fetchRequestedItems() + } + + fetchRequestedItems() { fetchJSON('https://apollo.kevinmidboe.com/api/v1/plex/requests/all', 'GET') .then(result => { this.setState({ @@ -32,6 +38,10 @@ class AdminComponent extends React.Component { }) } + updateHandler() { + this.fetchRequestedItems() + } + // Displays loginform if not logged in and passes response from // api call to sidebar and infoPanel through props verifyLoggedIn() { @@ -52,18 +62,19 @@ class AdminComponent extends React.Component { return (
+
+ +
-
- -
) }