diff --git a/index.js b/index.js index 9bf2b145652b64acf1779a5b085e477cb0508a85..e5b216292e0b4719fe070b47d765e26f9b9cee5a 100644 --- a/index.js +++ b/index.js @@ -244,8 +244,6 @@ async function buildAgregatedData(data, doctype) { } async function authenticate(login, password, baseUrl, apiAuthKey) { - - log("debug", "BEFORE REQUEST"); const authRequest = { method: "POST", uri: baseUrl + "/connect.aspx", @@ -265,8 +263,7 @@ async function authenticate(login, password, baseUrl, apiAuthKey) { } catch(e) { log("error", e) } - - log("debug", `Auth code: ${response.codeRetour}`); + if (response.codeRetour === 100) { return response; } else { @@ -295,14 +292,13 @@ async function getData(response, baseUrl, apiAuthKey) { try { // Sort data by date - log("debug", "TRY ?"); const responseEgl = await rp(dataRequest).then(eglRawData => { eglRawData.resultatRetour.sort(function(a, b) { return new Date(a.DateReleve) - new Date(b.DateReleve); }); return eglRawData; }); - log("debug", `Code retour: ${responseEgl.codeRetour}`); + switch (responseEgl.codeRetour) { case 100: return format(responseEgl); diff --git a/package.json b/package.json index d2499de0b1c81b48f16eb4582f5d1c7dc1d49482..d0d348b39b38c37eb3beb3fa155515e37461d613 100644 --- a/package.json +++ b/package.json @@ -33,8 +33,8 @@ "clean": "rm -rf ./data", "build": "webpack", "lint": "eslint --fix .", - "deploy": "git-directory-deploy --directory build/ --branch ${DEPLOY_BRANCH:-build} --repo=${DEPLOY_REPOSITORY:-https://forge.grandlyon.com/web-et-numerique/llle_project/egl-konnector.git}", - "deploy-dev": "git-directory-deploy --directory build/ --branch ${DEPLOY_BRANCH:-build-dev} --repo=${DEPLOY_REPOSITORY:-https://forge.grandlyon.com/web-et-numerique/llle_project/egl-konnector.git}", + "deploy": "git-directory-deploy --directory build/ --branch ${DEPLOY_BRANCH:-build}", + "deploy-dev": "git-directory-deploy --directory build/ --branch ${DEPLOY_BRANCH:-build-dev}", "cozyPublish": "cozy-app-publish --token $REGISTRY_TOKEN --build-commit $(git rev-parse ${DEPLOY_BRANCH:-build})", "travisDeployKey": "./bin/generate_travis_deploy_key" },