Added more data to mock-api and multiple sub-pages
This commit is contained in:
committed by
Erik Tiekstra
parent
9d82c91348
commit
cb5cb8b486
30
mock-api/dafa-web/scripts/staff.js
Normal file
30
mock-api/dafa-web/scripts/staff.js
Normal file
@@ -0,0 +1,30 @@
|
||||
import faker from 'faker';
|
||||
import kommuner from './kommuner.js';
|
||||
import services from './services.js';
|
||||
|
||||
faker.locale = 'sv';
|
||||
|
||||
const SERVICES = services.generate();
|
||||
const KOMMUN = kommuner.generate();
|
||||
const STATUSES = [true, false];
|
||||
|
||||
function generateStaff(amount = 10) {
|
||||
const staff = [];
|
||||
|
||||
for (let id = 1; id <= amount; ++id) {
|
||||
staff.push({
|
||||
id,
|
||||
firstName: faker.name.firstName(),
|
||||
lastName: faker.name.lastName(),
|
||||
kommun: KOMMUN[Math.floor(Math.random() * KOMMUN.length)].kommun,
|
||||
active: STATUSES[Math.floor(Math.random() * STATUSES.length)],
|
||||
service: SERVICES[Math.floor(Math.random() * SERVICES.length)].name,
|
||||
});
|
||||
}
|
||||
|
||||
return staff;
|
||||
}
|
||||
|
||||
export default {
|
||||
generate: generateStaff,
|
||||
};
|
||||
Reference in New Issue
Block a user