Updated mock-api and added relevant changes to deltagare-card component

This commit is contained in:
Erik Tiekstra
2021-08-04 08:30:09 +02:00
parent 3709987ee1
commit 5d1e357e83
6 changed files with 67 additions and 50 deletions

View File

@@ -106,12 +106,14 @@ function generateDeltagare(amount = 10) {
}))
: [],
},
disabilities: {
funktionsnedsattningar: Math.random() > 0.3 ? chooseRandom(DISABILITIES, faker.datatype.number(3)) : [],
},
// disabilities: {
// funktionsnedsattningar: Math.random() > 0.3 ? chooseRandom(DISABILITIES, faker.datatype.number(3)) : [],
// },
// TODO: Move to different structure. Temporary exposing disabilities in this structure as it is the way the API is exposing the data.
disabilities: [Math.random() > 0.3 ? chooseRandom(DISABILITIES, faker.datatype.number(3)) : []],
workExperiences: {
arbetslivserfarenheter: chooseRandom(WORK_EXPERIENCES, faker.datatype.number(WORK_EXPERIENCES.length)),
}
},
};
if (Math.random() > 0.8) {
deltagare.contact.adresser.push({

View File

@@ -1,38 +1,50 @@
function generateWorkExperiences() {
console.info('Work experiences generated...');
return [
{
yrke: 'Revisorer m.fl.',
beskrivning: 'asasaf',
arbetsgivare: 'Jobbet AB',
period_from: '20090501',
period_tom: '20110430'
},
{
yrke: 'Revisorer m.fl.',
beskrivning: 'asasaf',
arbetsgivare: 'Himmelsö AB',
period_from: '20130829',
period_tom: '20140128'
},
{
yrke: 'Revisorer m.fl.',
beskrivning: 'asasaf',
arbetsgivare: 'Himmelsö AB',
period_from: '20140129',
period_tom: '20141126'
},
{
yrke: 'Revisorer m.fl.',
beskrivning: 'AFAsdfasdf',
arbetsgivare: 'Distansutbildningsnämnden',
period_from: '20140527',
period_tom: '20141126'
},
];
}
export default {
generate: generateWorkExperiences,
};
console.info('Work experiences generated...');
return [
{
yrke: 'Administratör',
arbetsgivare: 'Eriksson',
period_from: '20020202',
period_tom: '20040404',
},
{
yrke: 'Militärer',
beskrivning: 'slödfkäqwefkop qwelöfk aäsdlöfk aäsdklöf aäldfk',
arbetsgivare: 'Grönlunds Trafikskola AB',
period_from: '20130301',
period_tom: '20131220',
},
{
yrke: 'Revisorer m.fl.',
beskrivning: 'asasaf',
arbetsgivare: 'Jobbet AB',
period_from: '20090501',
period_tom: '20110430',
},
{
yrke: 'Revisorer m.fl.',
beskrivning: 'asasaf',
arbetsgivare: 'Himmelsö AB',
period_from: '20130829',
period_tom: '20140128',
},
{
yrke: 'Revisorer m.fl.',
beskrivning: 'asasaf',
arbetsgivare: 'Himmelsö AB',
period_from: '20140129',
period_tom: '20141126',
},
{
yrke: 'Revisorer m.fl.',
beskrivning: 'AFAsdfasdf',
arbetsgivare: 'Distansutbildningsnämnden',
period_from: '20140527',
period_tom: '20141126',
},
];
}
export default {
generate: generateWorkExperiences,
};

View File

@@ -44,7 +44,7 @@ router.render = (req, res) => {
res.jsonp(res.locals.data);
} else {
let data = res.locals.data;
const deltagareRegex = /(?:\/customerinfo\/)(contact|driverlicense|education\/highest|education|translator|work\/disability|work\/languages)/g;
const deltagareRegex = /(?:\/customerinfo\/)(contact|driverlicense|education\/highest|education|translator|work\/disability|work\/languages|work\/experience)/g;
const isDeltagarePath = deltagareRegex.exec(pathname);
if (isDeltagarePath) {
@@ -90,6 +90,8 @@ function getDeltagareSubPath(path) {
return 'disabilities';
case 'work/languages':
return 'workLanguages';
case 'work/experience':
return 'workExperiences';
default:
return path;
}