优化提现手续费动态配置

This commit is contained in:
wangqiao
2025-10-08 22:22:54 +08:00
parent 89f3b9679d
commit 3f3ea878b9
4 changed files with 46 additions and 4 deletions

View File

@ -1,18 +1,20 @@
import { useFetch } from '#app'
import type { UseFetchOptions } from '#app'
import { isArray } from '~/utils/utils'
import useUserStore from '~/stores/user'
const useServerRequest = async <T>(url: string, opts?: UseFetchOptions<T, unknown>) => {
const token = useToken()
const runtimeConfig = useRuntimeConfig()
const userStore = useUserStore()
const defaultOptions: UseFetchOptions<unknown> = {
baseURL: runtimeConfig.public.apiBase,
onRequest({ options }) {
options.headers = options.headers || {}
if (token.value) {
options.headers.set('Authorization', `Bearer ${token.value}`)
if (token.value || userStore.token) {
options.headers.set('Authorization', `Bearer ${token.value || userStore.token}`)
}
},
onResponse({ response }) {