@life365/safe-request
v0.0.5
Published
Life365 safe request expecially for warehouse app
Downloads
2
Readme
Life365 package for made safe request in a not quite internet served environment
Create a request and if it get error, the request is redo after a number of seconds follow the fibonacci sequeces.
Workflow (eg):
- make request (error)
- make request (afer: 1s , error)
- make request (afer: 1s , error)
- make request (afer: 2s , error)
- make request (afer: 3s , error)
- make request (afer: 5s , error)
- make request (afer: 8s , done)
function setOrderDone(order_id){
const f = (order_id) => {
return fetch(ORDER_EDIT.replace('-1', order_id) +`?jwt=${JSON.parse(localStorage.getItem('user')).jwt}`, {
method: 'PUT',
body: JSON.stringify({
logistic_state: 'PICKED'
}),
headers: {
'Content-Type': 'application/json'
}
} )
}
decorateWithPolling(f)(order_id)
}