I usually just use Tanstack Query as an ergonomic wrapper for async functions to get the isLoading variable and define onSuccess, onError, etc. behavior

)