import type { AxiosError, AxiosResponse } from 'axios'; export const promiseHelper = (promise: any) => { // wpapi GET reads arrive as un-invoked, thenable request builders that expose // `.param()`. Append a unique vt_nocache so aggressive caches (LiteSpeed/CDN) // can't serve stale REST data on either the admin or public front-table side. // Already-invoked mutations and external axios promises have no `.param` and // are intentionally left untouched. if (typeof promise?.param === 'function') { promise.param('vt_nocache', Date.now()); } return promise.then( (response: AxiosResponse) => { return { response }; }, (error: AxiosError) => { return { error }; } ); };