how to use 4

node v10.24.1
version: 2.0.0
endpointsharetweet
const { success, failure, notAsked, loading, map, fold } = require('dataway'); // => Success ['MR', 'WILSON'] const render = dataway => fold( () => "<p>Click on the load button</p>", () => "<p>Loading</p>", error => `<p>something wrong did happen : ${error}</p>`, success => `<p>${success}</p>`, dataway ); render(success('Mr Wilson')); // => <p>Mr Wilson</p> render(failure('Ooops failed to fetch Mr Wilson data')); // => <p>something wrong did happen : Ooops failed to fetch Mr Wilson data</p> render(notAsked); // => '<p>Click on the load button</p>' render(loading); // => '<p>Loading</p>'
Loading…

no comments

    sign in to comment