Я даю запрос axios на получение данных с api, и по инструкции к api connection должен равняться keep-alive, но у меня close, и я хочу поменять close на keep-alive, но не знаю как,
вот код запроса
import router from '../../router/index'
import axios from 'axios'
export default{
state: {
posts: [],
perPage: 15,
page: 1,
total: 0,
loading: false,
s: []
},
getters: {
numPages: state => Math.ceil( state.total / state.perPage ),
},
mutations: {
updateLoading: ( state, loading ) => state.loading = loading,
updatePosts: ( state, { posts, total, page } ) => Object.assign( state, { posts, total, page } ),
},
actions: {
async fetchPosts( { commit, state }, page ) {
commit('updateLoading', true)
const params = router.currentRoute
const start = ( page - 1 ) * state.perPage;
const url = `/api/photos?${ params.name }=true&start=${ start }&limit=15`
try {
const response = await axios.get( url, { proxyHeaders: false,
credentials: false, } )
console.log( response )
const posts = await response.data
console.log( posts )
const total = posts.totalItems
commit( 'updatePosts', { posts, total, page })
} catch (e) {
console.error(e)
}
commit( 'updateLoading', false )
},
}
}