From de41dba688aacdc904d802b2c9155ba3308687d2 Mon Sep 17 00:00:00 2001
From: Bastien DUMONT <bdumont@grandlyon.com>
Date: Thu, 17 Nov 2022 15:48:13 +0100
Subject: [PATCH] feat: update url calls to adict/v2

---
 .prettierrc            | 4 ++++
 src/index.js           | 2 +-
 src/onDeleteAccount.js | 6 +++---
 3 files changed, 8 insertions(+), 4 deletions(-)
 create mode 100644 .prettierrc

diff --git a/.prettierrc b/.prettierrc
new file mode 100644
index 0000000..fd496a8
--- /dev/null
+++ b/.prettierrc
@@ -0,0 +1,4 @@
+{
+  "singleQuote": true,
+  "semi": false
+}
diff --git a/src/index.js b/src/index.js
index fe11af1..40860dc 100755
--- a/src/index.js
+++ b/src/index.js
@@ -100,7 +100,7 @@ async function getData(token, idPCE) {
     redirect: 'follow'
   }
   var url =
-    'https://api.grdf.fr/adict/v1/pce/' +
+    'https://api.grdf.fr/adict/v2/pce/' +
     idPCE +
     '/donnees_consos_informatives?date_debut=' +
     startDate +
diff --git a/src/onDeleteAccount.js b/src/onDeleteAccount.js
index 68c6efb..5d1942d 100644
--- a/src/onDeleteAccount.js
+++ b/src/onDeleteAccount.js
@@ -39,7 +39,7 @@ async function onDeleteAccount(accountId) {
           urlencoded.append('grant_type', 'client_credentials')
           urlencoded.append('client_id', accountSecret.client_id)
           urlencoded.append('client_secret', accountSecret.client_secret)
-          urlencoded.append('scope', '/adict/v1')
+          urlencoded.append('scope', '/adict/v2')
 
           var requestOptionsToken = {
             method: 'POST',
@@ -94,7 +94,7 @@ async function onDeleteAccount(accountId) {
       }
 
       let accessRights = await fetch(
-        'https://api.grdf.fr/adict/v1/droits_acces',
+        'https://api.grdf.fr/adict/v2/droits_acces',
         requestOptions
       )
         .then(async response => {
@@ -133,7 +133,7 @@ async function onDeleteAccount(accountId) {
           redirect: 'follow'
         }
 
-        var url = 'https://api.grdf.fr/adict/v1/droit_acces/' + accessRights
+        var url = 'https://api.grdf.fr/adict/v2/droit_acces/' + accessRights
 
         await fetch(url, deleteRequestOptions)
           .then(async response => {
-- 
GitLab