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
Merge requests
!9
Feat/insee code
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Feat/insee code
feat/insee-code
into
main
Overview
0
Commits
15
Pipelines
5
Changes
2
Merged
Hugo SUBTIL
requested to merge
feat/insee-code
into
main
2 years ago
Overview
0
Commits
15
Pipelines
5
Changes
2
Expand
0
0
Merge request reports
Viewing commit
e60ba22b
Prev
Next
Show latest version
2 files
+
6
−
1
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
e60ba22b
feat: throw user action needed error
· e60ba22b
Bastien DUMONT
authored
2 years ago
src/requests/insee.js
+
5
−
1
Options
@@ -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
}
}
Loading