mirror of
https://github.com/Xevion/the-office.git
synced 2025-12-17 16:13:36 -06:00
Add characters route link to top, add Vuex sorted characters getter
This commit is contained in:
11
src/store.js
11
src/store.js
@@ -167,6 +167,17 @@ export default new Vuex.Store({
|
||||
},
|
||||
getCharacter: (state) => (character_id) => {
|
||||
return state.characters[character_id];
|
||||
},
|
||||
getSortedCharacters: (state) => () => {
|
||||
let keys = Object.keys(state.characters);
|
||||
console.log(keys)
|
||||
keys.sort((a, b) => {
|
||||
const a_count = state.characters[a].appearances;
|
||||
const b_count = state.characters[b].appearances
|
||||
if (a_count < b_count) return 1;
|
||||
else return -1;
|
||||
})
|
||||
return keys;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user