diff --git a/index.html b/index.html index a874e93..b9b8b7b 100644 --- a/index.html +++ b/index.html @@ -16,15 +16,26 @@
Cette bibliothèque contient actuellement {{ booksCount }} livres et BD en format papier ou électronique.
+ -Id | +Nom | +
---|---|
{{ author.id }} | +{{ author.name }} | +
Titre | Auteur(s) | diff --git a/index.js b/index.js index 10c9336..4e76f1f 100644 --- a/index.js +++ b/index.js @@ -2,6 +2,7 @@ var app = new Vue({ el: '#app', data: { books: [], + authors: [], booksCount: 0, page: 1, perpage: 20 @@ -41,7 +42,12 @@ var app = new Vue({ loadIndex: function() { this.sendQuery('cgi-bin/bouquins/index', this.stdError, this.indexSuccess); }, + authorsSuccess: function(resp) { + this.books = []; + this.authors = resp; + }, booksSuccess: function(resp) { + this.authors = [] this.books = resp; }, prevPage: function() { @@ -54,6 +60,10 @@ var app = new Vue({ this.page++; this.loadBooks(); }, + loadAuthors: function() { + this.sendQuery('cgi-bin/bouquins/authors?page=' + this.page + '&perpage=' + this.perpage, + this.stdError, this.authorsSuccess); + }, loadBooks: function() { this.sendQuery('cgi-bin/bouquins/books?page=' + this.page + '&perpage=' + this.perpage, this.stdError, this.booksSuccess);
---|