From fc43beee3883b3a54339339912fc16bc3435fb81 Mon Sep 17 00:00:00 2001 From: Dragory <2606411+Dragory@users.noreply.github.com> Date: Thu, 10 Oct 2019 23:05:00 +0300 Subject: [PATCH] dashboard: sort guilds in guild list --- dashboard/src/components/dashboard/GuildList.vue | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/dashboard/src/components/dashboard/GuildList.vue b/dashboard/src/components/dashboard/GuildList.vue index 0202c8a8..17e6f8fe 100644 --- a/dashboard/src/components/dashboard/GuildList.vue +++ b/dashboard/src/components/dashboard/GuildList.vue @@ -60,7 +60,17 @@ }, computed: { ...mapState('guilds', { - guilds: 'available', + guilds: state => { + const guilds = Array.from(state.available || []); + guilds.sort((a, b) => { + if (a.name > b.name) return 1; + if (a.name < b.name) return -1; + if (a.id > b.id) return 1; + if (a.id < b.id) return -1; + return 0; + }); + return guilds; + }, }), }, };