Skip to content

Commit

Permalink
fix: return just the locations that user created
Browse files Browse the repository at this point in the history
  • Loading branch information
pauloedurezende committed Jan 11, 2019
1 parent ea1d9f7 commit 9841388
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/controllers/locations/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ route.get('/:locationId', verifyToken, (req, res) => {
const locationsData = readData(process.env.DATABASE_LOCATION);

const selectedLocation = locationsData.findIndex(
(location) => location.id === Number(req.params.locationId)
(location) =>
location.id === Number(req.params.locationId) &&
location.createdBy === req.userId
);

res.json(locationsData[selectedLocation]);
Expand Down

0 comments on commit 9841388

Please sign in to comment.