feat(employee-list): Added search functionality using API. (TV-221)
Squashed commit of the following: commit 4b93fcf4b8442a30c8d56cf8364f710b2d24c4e2 Author: Erik Tiekstra <erik.tiekstra@arbetsformedlingen.se> Date: Mon Jun 14 15:50:17 2021 +0200 Added fullName inside mock-api and filtering using api
This commit is contained in:
@@ -28,6 +28,7 @@ function generateEmployees(amount = 10) {
|
||||
createdAt: Date.now(),
|
||||
};
|
||||
|
||||
person.fullName = `${person.firstName} ${person.lastName}`;
|
||||
employees.push(person);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ server.use(
|
||||
'/api/*': '/$1',
|
||||
'*sort=services*': '$1sort=services[0].name$2',
|
||||
'*sort=organizations*': '$1sort=organizations[0].address.city$2',
|
||||
'*sort=fullName*': '$1sort=firstName,lastName$2',
|
||||
'/employee*search=*': '/employee$1fullName_like=$2',
|
||||
'/employee*': '/employees$1',
|
||||
'/participants': '/participants?_embed=employees',
|
||||
'/participant/:id': '/participants/:id?_embed=employees',
|
||||
@@ -24,10 +24,9 @@ server.use(
|
||||
);
|
||||
|
||||
router.render = (req, res) => {
|
||||
|
||||
// all paths except getToken requires Authorization header.
|
||||
if (!req._parsedUrl.pathname.includes('getToken') && !req.headers.authorization) {
|
||||
return res.status(401).jsonp({ error: "No valid access-token" });
|
||||
return res.status(401).jsonp({ error: 'No valid access-token' });
|
||||
}
|
||||
|
||||
const params = new URLSearchParams(req._parsedUrl.query);
|
||||
|
||||
Reference in New Issue
Block a user