import uploadUrl from '@/common/config.js'

uni.$u.http.setConfig((config) => {
	if (process.env.NODE_ENV === 'development') {
		config.baseURL = uploadUrl.baseUrl
	} else {
		config.baseURL = uploadUrl.baseUrl
	}
	config.header = {
		// 'Content-Type': 'application/x-www-form-urlencoded',
		'Content-type': 'application/json',
		'X-Requested-With': 'XMLHttpRequest',
		'Accept': 'application/vnd.api.v1+json'
	}

	return config
})

module.exports = (vm) => {
	require('./requestInterceptors')(vm)
	require('./responseInterceptors')(vm)
}