Dustella b8e4e63cf1
Some checks are pending
Test / build (lts/*, ubuntu-latest) (push) Waiting to run
Test / build (lts/*, windows-latest) (push) Waiting to run
update: iter 1.5
2025-01-21 22:27:09 +08:00

28 lines
521 B
TypeScript

import { createFetch } from '@vueuse/core'
import { API_BASE_URL } from '~/CONSTANT'
export const authCode = ref(
localStorage.getItem('authCode')
|| sessionStorage.getItem('authCode')
|| '',
)
export const baseFetch = createFetch({
baseUrl: API_BASE_URL,
options: {
async beforeFetch({ options }) {
const code = '0101'
options.headers = {
...options.headers,
Authorization: `${code}`,
}
return { options }
},
},
fetchOptions: {
mode: 'cors',
},
})