interface CommercetoolsHooks {
    onAfterResponse?: (response: CommercetoolsRequestResponse) => void;
    onBeforeRequest?: (
        requestConfig: CommercetoolsRequest,
    ) => CommercetoolsRequest | Promise<CommercetoolsRequest>;
}

Hierarchy (View Summary)

Properties

onAfterResponse?: (response: CommercetoolsRequestResponse) => void

If passed in, will be called once a request has been made and the response received (or error thrown).

onBeforeRequest?: (
    requestConfig: CommercetoolsRequest,
) => CommercetoolsRequest | Promise<CommercetoolsRequest>

If passed in, will be called before sending a request to commercetools. The {@see requestConfig} parameter can be manipulated if you wish to modify/add headers or any other request data.