From 09443556f08ba9f7c95bbfcfdbd189a44aaee3f9 Mon Sep 17 00:00:00 2001
From: Louis-Olivier Brassard <louis@loupbrun.ca>
Date: Sat, 10 Aug 2019 10:41:12 -0400
Subject: [PATCH] auteurs: Ordonner auteurs en ordre alphabetique

---
 src/components/AuthorsComponent.vue | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/src/components/AuthorsComponent.vue b/src/components/AuthorsComponent.vue
index 1cbe67b..090ae9e 100644
--- a/src/components/AuthorsComponent.vue
+++ b/src/components/AuthorsComponent.vue
@@ -81,7 +81,19 @@ export default {
       self.$http.get(global.api + 'authors'/* + filterFr + 'access_token=' + self.token*/, {progress () {
       }}).then(function (response) {
         var authors = JSON.parse(response.bodyText)
-        self.$set(this, 'dataAuthors', authors)
+
+        // order authors alphabetically
+        function compare (a, b) {
+          if (a.versions[0].name < b.versions[0].name) {
+            return -1
+          }
+          if (a.versions[0].name > b.versions[0].name) {
+            return 1
+          }
+          return 0
+        }
+
+        self.$set(this, 'dataAuthors', authors.sort(compare))
       }, function (response) {
         console.log('Error retrieving authors', response)
       }).finally(function () {
-- 
GitLab