添加服务类型

This commit is contained in:
zoujiandong
2023-09-19 09:53:37 +08:00
parent a3117d8b3f
commit e1d26f6b15
4 changed files with 59 additions and 159 deletions
+4
View File
@@ -19,10 +19,14 @@ service.interceptors.request.use(
// Store 必须在拦截器内部导入,在外部导入会显示 Pinia 未初始化
const store = useUserStore();
// 设置请求头部 Authorization
if(config.method=="put"){
config.headers['Content-Type'] = 'application/x-www-form-urlencoded'
}
if (store.token) {
config.headers['Authorization'] = 'Bearer ' + store.token;
//config.headers['Content-Type'] = 'multipart/form-data'
}
return config;
},
(error) => {