9 lines
347 B
JavaScript
9 lines
347 B
JavaScript
|
|
import axios from 'axios'
|
||
|
|
|
||
|
|
// Navigation and polling deliberately abort obsolete requests. Keep rejection
|
||
|
|
// semantics for the caller, while reserving notifications for real failures.
|
||
|
|
export function rejectRequestFailure(error, notify) {
|
||
|
|
if (!axios.isCancel(error) && error?.name !== 'AbortError') notify(error)
|
||
|
|
return Promise.reject(error)
|
||
|
|
}
|