Home > front end >  Ask: how to use the dispatch in function
Ask: how to use the dispatch in function

Time:09-25

 export function spinWrapper (fun) {
Return async function spinWrapFun (... The args) {
//this. Props. Dispatch ({
//type: 'myblog/global/prepareRequest'
//});
Let the data;
Try {
Data=https://bbs.csdn.net/topics/await fun (... The args);
If (data redultCode!=='OK' | | data. Success!==true) {
Throw the Error (data);
}
{} the catch (error)
Throw the error;
} the finally {
return data;
//this. Props. Dispatch ({
//type: 'myblog/global/requestFinish'
//});
}
//return data;
};
};
  • Related