chore: add i18n support for TabsView.vue; 🌟
This commit is contained in:
@@ -3,10 +3,10 @@ import Cookie from 'js-cookie'
|
||||
axios.defaults.timeout = 5000
|
||||
axios.defaults.withCredentials= true
|
||||
|
||||
const cookies = Cookie.get()
|
||||
Object.keys(cookies).forEach(key => {
|
||||
axios.defaults.headers.common[key] = cookies[key]
|
||||
})
|
||||
// const cookies = Cookie.get()
|
||||
// Object.keys(cookies).forEach(key => {
|
||||
// axios.defaults.headers.common[key] = cookies[key]
|
||||
// })
|
||||
|
||||
const METHOD = {
|
||||
GET: 'get',
|
||||
@@ -21,13 +21,16 @@ const METHOD = {
|
||||
* @returns {Promise<AxiosResponse<T>>}
|
||||
*/
|
||||
async function request(url, method, params) {
|
||||
// header 加入 token
|
||||
const token = Cookie.get('Authorization')
|
||||
const config = token ? {headers: {Authorization: token}} : {}
|
||||
switch (method) {
|
||||
case METHOD.GET:
|
||||
return axios.get(url, {params})
|
||||
return axios.get(url, {params, ...config})
|
||||
case METHOD.POST:
|
||||
return axios.post(url, params)
|
||||
return axios.post(url, params, config)
|
||||
default:
|
||||
return axios.get(url, {params})
|
||||
return axios.get(url, {params, ...config})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user