Skip to content

Commit

Permalink
Fetch changeRequests only for Admin users
Browse files Browse the repository at this point in the history
  • Loading branch information
Pav0l committed Sep 17, 2019
1 parent d147e61 commit e986b25
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/components/App/App.js
Expand Up @@ -49,8 +49,12 @@ function App() {
data: undefined,
cleanedData: undefined
});

// fetch changeRequests only for admin users
if (user.isAdmin) {
loadChangeRequest();
}
loadFarmers();
loadChangeRequest();
setNeedsUpdate(false);
}
}, [user, needsUpdate]);
Expand All @@ -64,7 +68,7 @@ function App() {
});
})
.catch(error => {
toast.error(error.message)
toast.error(error.message);
});
};

Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Expand Up @@ -6636,6 +6636,11 @@ mkdirp@0.5.1, mkdirp@0.5.x, mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.1:
dependencies:
minimist "0.0.8"

moment@^2.24.0:
version "2.24.0"
resolved "https://registry.yarnpkg.com/moment/-/moment-2.24.0.tgz#0d055d53f5052aa653c9f6eb68bb5d12bf5c2b5b"
integrity sha512-bV7f+6l2QigeBBZSM/6yTNq4P2fNpSWj/0e7jQcy87A8e7o2nAfP/34/2ky5Vw4B9S446EtIhodAzkFCcR4dQg==

move-concurrently@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/move-concurrently/-/move-concurrently-1.0.1.tgz#be2c005fda32e0b29af1f05d7c4b33214c701f92"
Expand Down

0 comments on commit e986b25

Please sign in to comment.