MCPcopy Index your code
hub / github.com/Packstack-Tech/packstack / makeRequestConfig

Method makeRequestConfig

frontend/src/lib/api/base-api.ts:29–43  ·  view source on GitHub ↗
(cfg?: AxiosRequestConfig)

Source from the content-addressed store, hash-verified

27 }
28
29 makeRequestConfig(cfg?: AxiosRequestConfig): AxiosRequestConfig {
30 const config: AxiosRequestConfig = cfg || {};
31 const headers = config.headers || {};
32 const baseURL = process.env.NODE_ENV === 'production' ? process.env.REACT_APP_API_PROD : process.env.REACT_APP_API_DEV;
33
34 const defaultHeaders = this.makeDefaultHeaders();
35 return {
36 ...config,
37 baseURL,
38 headers: {
39 ...defaultHeaders,
40 ...headers
41 }
42 };
43 }
44
45 post<S, T>(url: string, data: S, config?: AxiosRequestConfig): Promise<void | AxiosResponse<T>> {
46 return axios.post<T>(url, data, this.makeRequestConfig(config)).catch((err: AxiosError) => {

Callers 3

postMethod · 0.95
putMethod · 0.95
getMethod · 0.95

Calls 1

makeDefaultHeadersMethod · 0.95

Tested by

no test coverage detected