houdini/app/javascript/legacy/common/get-valid-data.js

12 lines
341 B
JavaScript
Raw Normal View History

2019-11-06 20:36:28 +00:00
// License: LGPL-3.0-or-later
const flyd = require('flimflam/flyd')
const request = require("../common/request")
module.exports = (path, query) => {
const url = '/'
const response$ = request({method: 'GET', url, path, query}).load
const valid$ = flyd.filter(x => x.status === 200, response$)
return flyd.map(x => x.body, valid$)
}