Using the promise functions then-catch to make the process simpler I use this utils :
// utils.js
const utils = promise => (
promise
.then(data => ({ data, error: null }))
.catch(error => ({ error, data: null }))
);
module.exports = utils;
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…