mirror of
https://github.com/bitwarden/browser.git
synced 2024-09-01 00:10:39 +02:00
sort orgs
This commit is contained in:
parent
6267ca52fc
commit
0f9186628b
|
@ -36,7 +36,22 @@ export class OrganizationsComponent implements OnInit {
|
|||
}
|
||||
|
||||
async load() {
|
||||
this.organizations = await this.userService.getAllOrganizations();
|
||||
const orgs = await this.userService.getAllOrganizations();
|
||||
orgs.sort((a, b) => {
|
||||
if (a.name == null && b.name != null) {
|
||||
return -1;
|
||||
}
|
||||
if (a.name != null && b.name == null) {
|
||||
return 1;
|
||||
}
|
||||
if (a.name == null && b.name == null) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return this.i18nService.collator ? this.i18nService.collator.compare(a.name, b.name) :
|
||||
a.name.localeCompare(b.name);
|
||||
});
|
||||
this.organizations = orgs;
|
||||
this.loaded = true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user