Closed hanalice closed 2 years ago
@clock157 @yesmeck @yutingzhao1991
hello, anyone can help?
I found the root cause, it's a coding problem.
I init the run function with run: () => {}
, when it's a successful response it will re-value the run function to the return run of useRequest, so it can work successfully. But the data return from useRequest is null when encounting 500, so it will not change the initial definition of run function. so it does nothing as defined at the begining.
import { useRequest } from "ahooks";
const { loading, data, error, run }= useRequest(service, options);
run() can successfully work, but if response.status >= 200 && response.status < 300, it will throw
throw new ResponseError(copy, 'http error', body, req, 'HttpError');
, and then run() can no longer work???