chore: Add Axios header config when https protocol use!!

This commit is contained in:
yoosangwook 2024-10-07 11:39:38 +09:00
parent b8972c059e
commit b1f7d50c32

View File

@ -10,12 +10,14 @@ export function useAxios(lang = '') {
let type = AxiosType.INTERNAL
url.startsWith('http') ? (type = AxiosType.EXTERNAL) : ''
let headerValue = {
Accept: 'application/json',
}
url.startsWith('https') ? '' : (headerValue['lang'] = lang)
return axios.create({
baseURL: type === AxiosType.INTERNAL ? process.env.NEXT_PUBLIC_API_SERVER_PATH : '',
headers: {
Accept: 'application/json',
lang,
},
headers: headerValue,
})
}