From 93bff2dd53324f9e0c16ffb2095168ef07b096b5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Chauveau?= <jerome.chauveau@unicaen.fr>
Date: Wed, 9 Dec 2020 10:30:27 +0100
Subject: [PATCH] =?UTF-8?q?ajout=20du=20param=C3=A8trage=20du=20type=20de?=
 =?UTF-8?q?=20ressource=20(user|group),=20et=20utilisation=20du=20user=20z?=
 =?UTF-8?q?otero=20475425=20par=20d=C3=A9faut?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .env                                    | 3 +++
 README.md                               | 7 ++++---
 src/App.vue                             | 3 ++-
 src/components/ZoteroQueryComponent.vue | 2 +-
 src/config/config.js                    | 1 +
 5 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/.env b/.env
index 7ad6586..7a5ad00 100644
--- a/.env
+++ b/.env
@@ -1,2 +1,5 @@
 VUE_APP_APP_NAME=Zotero Client
 VUE_APP_URL_PATH=/zotero-vue-client/
+VUE_APP_DEFAULT_USER_GROUP_ID=475425
+VUE_APP_DEFAULT_TYPE=user
+
diff --git a/README.md b/README.md
index 5e2cb21..bfec305 100644
--- a/README.md
+++ b/README.md
@@ -23,16 +23,17 @@ yarn lint
 ## component usage example
 
 ```
-<zotero-query-component :default-id="1234" @entrySelected="selectedEntryCallback"/>
+<zotero-query-component :default-type="user" :default-id="1234" @entrySelected="selectedEntryCallback"/>
 ```
 
-where default-id is a group or user id (https://www.zotero.org/support/dev/web_api/v3/basics)
+where default-type is "user" or "group" and default-id is a group or user id (https://www.zotero.org/support/dev/web_api/v3/basics)
 
 Another example with custom options :
 
 ```
 <zotero-query-component 
-    :default-id="1234" 
+    :default-type="user"
+    :default-id="475425" 
     :options="{
         pageLength: 10,
         editableConfig: false,
diff --git a/src/App.vue b/src/App.vue
index 42e734c..54a0977 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -1,5 +1,5 @@
 <template>
-    <zotero-query-component :default-id="groupOrUserId" @entrySelected="selectedEntry"/>
+    <zotero-query-component :default-type="resourceType" :default-id="groupOrUserId" @entrySelected="selectedEntry"/>
 </template>
 
 <script>
@@ -12,6 +12,7 @@
         },
         data(){
             return {
+                resourceType: config.RESOURCE_TYPE,
                 groupOrUserId: config.USER_GROUP_ID
             }
         },
diff --git a/src/components/ZoteroQueryComponent.vue b/src/components/ZoteroQueryComponent.vue
index d1aed27..6a4474b 100644
--- a/src/components/ZoteroQueryComponent.vue
+++ b/src/components/ZoteroQueryComponent.vue
@@ -70,7 +70,7 @@
             defaultId : String,
             defaultType : {
                 type : String,
-                default : 'group'
+                default : 'users'
             },
             options : {
                 type: Object,
diff --git a/src/config/config.js b/src/config/config.js
index 9a73fc0..2ac6462 100644
--- a/src/config/config.js
+++ b/src/config/config.js
@@ -1,4 +1,5 @@
 var config = {
+    RESOURCE_TYPE : process.env.VUE_APP_DEFAULT_TYPE,
     USER_GROUP_ID: process.env.VUE_APP_DEFAULT_USER_GROUP_ID,
     API_KEY: process.env.VUE_APP_ZOTERO_API_KEY,
 
-- 
GitLab