2025-05-06 22:16:31 +08:00

23 lines
545 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import axios from "axios"
import { getEncodeHeader } from "./tool/index"
// axios 拦截器
const api = axios.create({
baseURL: "https://live-open.biliapi.com"
// baseURL: "http://test-live-open.biliapi.net" //test
})
// 鉴权加密处理headers下次请求自动带上
api.interceptors.request.use(config => {
const headers = getEncodeHeader(
config.data,
global.appKey,
global.appSecret
)
console.log('headers: ', headers)
config.headers = headers
return config
})
export default api