Skip to content

Commit

Permalink
Fix [API] browser caching
Browse files Browse the repository at this point in the history
  • Loading branch information
mavdryk committed Nov 10, 2023
1 parent 34a418f commit 4443484
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/httpClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,31 @@ such restriction.
import axios from 'axios'
import qs from 'qs'

const headers = {
'Cache-Control': 'no-cache'
}
export const mainBaseUrl = `${process.env.PUBLIC_URL}/api/v1`

export const mainHttpClient = axios.create({
baseURL: mainBaseUrl,
headers,

// serialize a param with an array value as a repeated param, for example:
// { label: ['host', 'owner=admin'] } => 'label=host&label=owner%3Dadmin'
paramsSerializer: params => qs.stringify(params, { arrayFormat: 'repeat' })
})

export const functionTemplatesHttpClient = axios.create({
baseURL: `${process.env.PUBLIC_URL}/function-catalog`
baseURL: `${process.env.PUBLIC_URL}/function-catalog`,
headers
})

export const nuclioHttpClient = axios.create({
baseURL: `${process.env.PUBLIC_URL}/nuclio/api`
baseURL: `${process.env.PUBLIC_URL}/nuclio/api`,
headers
})

export const iguazioHttpClient = axios.create({
baseURL: process.env.NODE_ENV === 'production' ? '/api' : '/iguazio/api'
baseURL: process.env.NODE_ENV === 'production' ? '/api' : '/iguazio/api',
headers
})

0 comments on commit 4443484

Please sign in to comment.