refactor: 将 apps 重命名为 containers 并同步 harness 默认路径
example-project 与占位符/安装器默认改为 containers/backend|frontend,探测仍兼容旧 apps/。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
20
example-project/containers/frontend/src/utils/request.ts
Normal file
20
example-project/containers/frontend/src/utils/request.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import axios from 'axios'
|
||||
|
||||
const http = axios.create({
|
||||
baseURL: '/api/v1',
|
||||
timeout: 15000,
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
})
|
||||
|
||||
http.interceptors.request.use(cfg => {
|
||||
const token = localStorage.getItem('token')
|
||||
if (token) cfg.headers.Authorization = `Bearer ${token}`
|
||||
return cfg
|
||||
})
|
||||
|
||||
http.interceptors.response.use(
|
||||
r => r,
|
||||
e => Promise.reject(e)
|
||||
)
|
||||
|
||||
export default http
|
||||
Reference in New Issue
Block a user