u
This commit is contained in:
1 parent
ca2fa3543d
commit
7333e6695f
13 files changed
+211
-105
No files matched your search
@@ -0,0 +1,21 @@
|
||||
import { createAlova } from 'alova'
|
||||
import { createServerTokenAuthentication } from 'alova/client'
|
||||
import adapterFetch from 'alova/fetch'
|
||||
const { onAuthRequired, onResponseRefreshToken } = createServerTokenAuthentication({
|
||||
// ...
|
||||
})
|
||||
|
||||
const alovaInstance = createAlova({
|
||||
baseURL: 'http://192.168.1.136:8085/app',
|
||||
requestAdapter: adapterFetch(),
|
||||
// ...
|
||||
beforeRequest: onAuthRequired((method) => {
|
||||
// ...原请求前拦截器
|
||||
}),
|
||||
responded: onResponseRefreshToken((response, method) => {
|
||||
// ...原响应成功拦截器
|
||||
return response.json()
|
||||
}),
|
||||
})
|
||||
|
||||
export default alovaInstance
|
||||
Reference in new issue
Block a user