Fixed mock-api for single employee requests

This commit is contained in:
Erik Tiekstra
2021-08-19 11:42:55 +02:00
parent d4874d6cd5
commit d6e46668e5

View File

@@ -58,6 +58,8 @@ router.render = (req, res) => {
}
let data = res.locals.data;
const employeeRegex = /(?:\/users\/)(.*)/;
const isEmployeePath = employeeRegex.exec(pathname);
const deltagareRegex = /(?:\/deltagare\/)(?:\d\/)(contact|driverlicense|educationlevels\/highest|educations|translator|work\/disabilities|work\/languages|work\/experiences)/g;
const isDeltagarePath = deltagareRegex.exec(pathname);
const avropRegex = /(?:\/avrop\/(?:tjanster|utforandeverksamheter|kommuner|\d))|(?:\/deltagare\/\d\/(avrop))/g;
@@ -65,6 +67,10 @@ router.render = (req, res) => {
const authRegex = /(?:\/auth\/)(userinfo|organizations)/g;
const isAuthPath = authRegex.exec(pathname);
if (isEmployeePath) {
data = data[0];
}
if (isAuthPath) {
const authSubPath = isAuthPath[1];