Asynchronous Hooks

Asynchronous hooks status interface

useStartFinishErrors
const { updateAddress, ...updateStatus } = useCustomerUpdateAddress();

// Main status helpers
const { started, finished, success, errors, reset, } = updateStatus;

status

initial

onSuccess

onError

started

true or false

false

true

true

Request started

finished

true or false

false

true

true

Request finished

success

true or false

false

true

false

Request finished without errors

errors

[] or [..'error']

[]

[]

[...'error']

Request errors

setStarted

fn

overwrite started

setFinished

fn

overwrite finished

setErrors

fn

append error(s)

setSuccess

fn

overwrite success

reset

fn

reset statuses to initial

resetTimer

ref

helper ref setTimeout

Async hooks options

autoReset

ms

auto resets "success" and "errors" states ms after completed

Using async hook status

Last updated