Skip to content
This repository has been archived by the owner on Sep 11, 2020. It is now read-only.

Commit

Permalink
feat(flux): adapte l'appel de l'api suite au refacto de l'api (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
NeoBahamut authored May 11, 2020
1 parent d306254 commit 5442d99
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
5 changes: 4 additions & 1 deletion lib/api/queries/titres.gql
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ query Titres(
substances: $substances
territoires: $territoires
) {
...titre
elements {
...titre
}
total
}
}

Expand Down
4 changes: 2 additions & 2 deletions lib/public/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const geojsonsBuild = async (definitions, query, metas) =>
definitions.reduce(async (geojsons, definition) => {
const titres = await apiGet('titres', { query, variables: definition })

if (!titres || !titres.length) return geojsons
if (!titres.elements || !titres.elements.length) return geojsons

const { domaines, types, statuts } = metasBuild(definition, metas)

Expand All @@ -70,7 +70,7 @@ const geojsonsBuild = async (definitions, query, metas) =>
...metasFormat(metas),
}

const geojson = geojsonFormat(titres, properties)
const geojson = geojsonFormat(titres.elements, properties)

return (await geojsons).concat(geojson)
}, Promise.resolve([]))
Expand Down
4 changes: 2 additions & 2 deletions lib/titres/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@ const titresGet = async (req, res) => {
token
)

if (!titres || !titres.length) return res.send([])
if (!titres.elements || !titres.elements.length) return res.send([])

// construit le flux geojson
const geojson = geojsonFormat(titres, {
const geojson = geojsonFormat(titres.elements, {
...metasFormat(metas),
})

Expand Down

0 comments on commit 5442d99

Please sign in to comment.