adding propertie to state for travelers not in the selected edition

This commit is contained in:
Dave 2021-01-08 17:55:46 +00:00
parent 012954f7f4
commit c1db6aa447
1 changed files with 10 additions and 0 deletions

View File

@ -25,6 +25,15 @@ const getRolesByEdition = (edition = editionJSON[0]) => {
); );
}; };
const getTravelersNotInEdition = (edition = editionJSON[0]) => {
return new Map(
rolesJSON
.filter(r => r.team === "traveler")
.filter(r => r.edition !== edition.id || !edition.roles.includes(r.id))
.map(role => [role.id, role])
);
};
// base definition for custom roles // base definition for custom roles
const imageBase = const imageBase =
"https://raw.githubusercontent.com/bra1n/townsquare/main/src/assets/icons/"; "https://raw.githubusercontent.com/bra1n/townsquare/main/src/assets/icons/";
@ -70,6 +79,7 @@ export default new Vuex.Store({
}, },
edition: editionJSONbyId.get("tb"), edition: editionJSONbyId.get("tb"),
roles: getRolesByEdition(), roles: getRolesByEdition(),
extraTravelers: getTravelersNotInEdition(),
fabled fabled
}, },
getters: { getters: {