Commit 4d6ec178 authored by Jerome Chauveau's avatar Jerome Chauveau
Browse files

ajout de l'url de la ref dans l'événement de sélection

parent e316f579
{
"name": "zotero-vue-client",
"version": "0.1.1",
"version": "0.1.2",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
......
......@@ -18,9 +18,9 @@
},
methods : {
selectedEntry(entryKey, serializedEntry){
console.log("entry key = ", entryKey)
alert(serializedEntry)
selectedEntry(entry){
console.log("entry key = ", entry.key)
alert(entry.serialized)
}
}
}
......
......@@ -110,11 +110,14 @@
}
},
methods: {
doQuery() {
doQuery(reset=true) {
if(reset)
this.currentPage = 1;
this.isFetching = true;
this.entries = null;
let library = new Zotero.Library(this.type, this.groupOrUserId);
library.loadItems({start: this.start, limit: this.pageLength, q: this.textQuery}).then((response)=>{
console.log(response.data)
this.entries = response.data;
this.nbResults = response.totalResults;
this.isFetching = false;
......@@ -124,19 +127,29 @@
previousPage(){
this.start -= this.pageLength;
this.currentPage --;
this.doQuery();
this.doQuery(false);
},
nextPage(){
this.start += this.pageLength;
this.currentPage ++;
this.doQuery();
this.doQuery(false);
},
entrySelected(entryKey){
let suffix = this.type + 's' +'/' + this.groupOrUserId + '/items/' + entryKey
fetch('https://api.zotero.org/'
+ this.type + 's' +'/' + this.groupOrUserId + '/items/' + entryKey + '?format=' + this.format)
.then(response => response.text()).then(entry => { this.$emit('entry-selected',entryKey, entry)})
+ suffix + '?format=' + this.format)
.then(response => response.text()).then(entry => {
console.log()
this.$emit(
'entry-selected',
{
key: entryKey,
url : 'http://zotero.org/' + suffix,
serialized :entry
})
})
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment