Skip to content
Snippets Groups Projects
Commit a9f74347 authored by Bastien DUMONT's avatar Bastien DUMONT :angel:
Browse files

feat: findUserPdl throws login failed

parent bdeb7441
No related branches found
No related tags found
2 merge requests!12Feat/donnes tech debut contrat,!10Feat/rechercher point
......@@ -6,7 +6,7 @@ const { rechercherPoint } = require('./requests/sge')
const xml2js = require('xml2js')
/**
* @return {Promise<string>} User Pdl
* @return {Promise<string | null>} User Pdl
*/
async function findUserPdl(
url,
......@@ -38,8 +38,11 @@ async function findUserPdl(
explicitArray: false,
})
//TODO: handle errors
return parseUserPdl(parsedReply)
try {
return parseUserPdl(parsedReply)
} catch (error) {
throw errors.LOGIN_FAILED
}
}
module.exports = { findUserPdl }
......@@ -32,8 +32,7 @@ const {
getBoConsent,
deleteBoConsent,
} = require('./requests/bo')
const verifyUserIdentity = require('./verifyUserIdentity')
const { verifyUserIdentity } = require('./verifyUserIdentity')
moment.locale('fr') // set the language
moment.tz.setDefault('Europe/Paris') // set the timezone
......
......@@ -28,7 +28,6 @@ async function verifyUserIdentity(
inseeCode
)
console.log(pdl)
console.log(fields.pointId)
if (fields.pointId != pdl) {
log('error', 'PointId does not match')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment