Fixed some issues with invites mock-data and response from api

This commit is contained in:
Erik Tiekstra
2021-09-01 13:39:01 +02:00
parent 70ab2c3ee4
commit 803422dbc5
6 changed files with 91 additions and 48 deletions

View File

@@ -11,18 +11,17 @@ server.use(
'/api/*': '/$1',
'*sort=utforandeVerksamhet*': '$1sort=utforandeVerksamhet[0]$2',
'*sort=tjanst*': '$1sort=tjanst[0]$2',
'/users/invite*': '/invites$1',
'/users/:id': '/employees?ciamUserId=:id',
'/users*': '/employees$1',
'/employees*search=*': '/employees$1fullName_like=$2',
'/employees*onlyEmployeesWithoutAuthorization=*': '/employees$1roles.length_lte=1',
'/employees/invite': '/invites',
'/employees*': '/employees$1',
'/services*': '/tjanster$1',
'/participants': '/participants?_embed=employees',
'/participant/:id': '/participants/:id?_embed=employees',
'/auth/userinfo': '/currentUser',
'/auth/organizations': '/currentUser',
'/avrop/handledare/assign*': '/avrop$1',
'/avrop/tjanster*': '/avropTjanster$1',
'/avrop/handledare*': '/handledare$1',
'/avrop/utforandeverksamheter*': '/utforandeVerksamheter$1',
@@ -33,7 +32,6 @@ server.use(
'/deltagare?*': '/avrop?$1',
'/deltagare/:sokandeId/avrop': '/avrop?sokandeId=:sokandeId',
'/deltagare/:sokandeId/*': '/deltagare/:sokandeId',
'/employees/invite': '/invites',
'*page=*': '$1_page=$2',
'*limit=*': '$1_limit=$2',
'*sort=*': '$1_sort=$2',
@@ -55,8 +53,19 @@ router.render = (req, res) => {
}
if (method === 'PATCH') {
// Returning status 204 as this is the same as in the API, BUT we're not actually updating the mock-api
return res.status(204).jsonp();
if (pathname === '/handledare/assign') {
// Returning status 204 as this is the same as in the API, BUT we're not actually updating the mock-api
return res.status(204).jsonp();
}
if (pathname === '/invites' && req.body?.emails) {
return res.status(200).jsonp({
data: {
invitedUsers: req.body.emails,
assignedUsers: [],
existingUsersInCurrentOrg: [],
},
});
}
}
// Return custom error when status is 404.