Change logic for loading
apenab opened this issue · 2 comments
apenab commented
In my personal use, I replace loading for status(status of request) => ["loading", "success", "error", "init"] is more clear in the moment to know the request status
int64ago commented
I think this should not be handled in this hook, you can make a transforming in your own project:
if (loading) {
status === 'loading';
} else if (error) {
status === 'error';
} else if (response) {
status === 'success';
} else {
status === 'init';
}The hook is aim to provider atomic state.
Actually, useAxios is not suited to use directly in real-world project.
In my usage scene, i write a local useFetch hook based on useAxios which does many project-related things, such as data formatting, common headers setting, etc.
int64ago commented
Closed, feel free to reopen if necessary