import axios, { type AxiosRequestConfig } from "axios" export function useGet(path: string, options: AxiosRequestConfig = {}) { console.log('useGet') return useAsyncData(path, async () => { if (import.meta.client) { const auth = useAuth() const getToken = auth.getToken.value const token = await getToken() options.headers = { 'Authorization': `Bearer ${token}` } const result = await axios.get(path, options) return result.data } else { const headers = useRequestHeaders(['cookie']) options.headers = headers const result = await axios.get(path, options) return result.data } }) }