DirektoratetForByggkvalitet / losen

Losen - a flexible wizard framework
5 stars 2 forks source link

Fetch data from Sentral godkjenning #61

Closed Andersos closed 7 years ago

Andersos commented 7 years ago

Fetch and display data from api around sentral godkjenning

celineengg commented 7 years ago

https://dibk.no/sentral_godkjenning/Om-ordningen/API-for-sgregister/

kbrabrand commented 7 years ago

https://sgregister.dibk.no/api/enterprises/992294035.json

Andersos commented 7 years ago
Andersos commented 7 years ago

So we need a way for FetchOrg to trigger changes in FetchSG. The solution Im looking into now is a way to subscribe to the redux store and look for changes in the orgid of the property of FetchOrg.

Looking for a library from this list https://github.com/markerikson/redux-ecosystem-links/blob/master/store.md#store-change-subscriptions

kbrabrand commented 7 years ago

For the string interpolation lodash.template is probably one of the easier ways to go about it:

From the docs

// Use the ES template literal delimiter as an "interpolate" delimiter.
// Disable support by replacing the "interpolate" delimiter.
var compiled = _.template('hello ${ user }!');
compiled({ 'user': 'pebbles' });
// => 'hello pebbles!'
Andersos commented 7 years ago

Replaced my regex impl with the lodash template. Works really well.

Andersos commented 7 years ago

Didnt go with the redux subscribe solution but @elisejakob suggested that we put the fetchSG block inside the fetchOrg block.