Sort accounts by preferredName field

This commit is contained in:
Benedikt Kulmann
2020-07-01 10:31:35 +02:00
parent a8922f62c2
commit e23615c764
2 changed files with 9 additions and 5 deletions

View File

File diff suppressed because one or more lines are too long

View File

@@ -14,8 +14,12 @@ const getters = {
config: state => state.config,
isInitialized: state => state.initialized,
getAccountsSorted: state => {
// FIXME: look at data fields for available sorting options
return Object.values(state.accounts)
return Object.values(state.accounts).sort((a1, a2) => {
if (a1.preferredName === a2.preferredName) {
return a1.id.localeCompare(a2.id)
}
return a1.preferredName.localeCompare(a2.preferredName)
})
}
}