Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
enedis_sge_konnector
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
web-et-numerique
Factory
LLLE_Project
enedis_sge_konnector
Commits
e60ba22b
Commit
e60ba22b
authored
2 years ago
by
Bastien DUMONT
Browse files
Options
Downloads
Patches
Plain Diff
feat: throw user action needed error
parent
e284ce29
No related branches found
No related tags found
1 merge request
!9
Feat/insee code
Pipeline
#39664
passed
2 years ago
Stage: test
Stage: build
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/index.js
+1
-0
1 addition, 0 deletions
src/index.js
src/requests/insee.js
+5
-1
5 additions, 1 deletion
src/requests/insee.js
with
6 additions
and
1 deletion
src/index.js
+
1
−
0
View file @
e60ba22b
...
...
@@ -123,6 +123,7 @@ async function verifyUserIdentity(
loginUtilisateur
)
{
const
inseeCode
=
await
getInseeCode
(
fields
.
postalCode
)
if
(
!
inseeCode
)
throw
errors
.
USER_ACTION_NEEDED
const
pdl
=
await
findUserPdl
(
`
${
baseUrl
}
/enedis_SDE_recherche-point/1.0`
,
...
...
This diff is collapsed.
Click to expand it.
src/requests/insee.js
+
5
−
1
View file @
e60ba22b
...
...
@@ -12,8 +12,8 @@ const API_URL = 'https://apicarto.ign.fr/api/codes-postaux/communes'
*/
async
function
getInseeCode
(
postalCode
,
city
)
{
try
{
const
response
=
await
axios
.
get
(
`
${
API_URL
}
/
${
postalCode
}
`
)
log
(
'
info
'
,
`Query getInseeCode for postalCode
${
postalCode
}
/
${
city
}
`
)
const
response
=
await
axios
.
get
(
`
${
API_URL
}
/
${
postalCode
}
`
)
if
(
response
.
data
.
length
===
1
)
{
return
response
.
data
[
0
].
codeCommune
...
...
@@ -26,6 +26,10 @@ async function getInseeCode(postalCode, city) {
return
filteredResponse
[
0
].
codeCommune
}
}
catch
(
error
)
{
log
(
'
error
'
,
`Query getInseeCode failed for postalCode
${
postalCode
}
/
${
city
}
`
)
return
null
}
}
...
...
This diff is collapsed.
Click to expand it.
Ghost User
@ghost
mentioned in commit
8df636c5
·
2 years ago
mentioned in commit
8df636c5
mentioned in commit 8df636c5eb866d7dc1745f800a80f893957a878d
Toggle commit list
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment