effect can return value for abort api call
geoffgu opened this issue · comments
@effect
async fetch() {
let pendingRequest = API.call(); // promise
this.$update({ isLoading: true });
function autoRun() {
const result = await pendingRequest;
this.$update({ isLoading: false, result });
}
function abort() {
pendingRequest.abort();
}
return {
abort,
autoRun,
}
}
enhance effect