获取对话信息

This commit is contained in:
XIE7654
2025-07-17 17:21:38 +08:00
parent ff47665dcb
commit e79eb196f2
4 changed files with 47 additions and 48 deletions

View File

@@ -0,0 +1,11 @@
import { formatToken } from '#/utils/auth';
import { useAccessStore } from '@vben/stores';
export function fetchWithAuth(input: RequestInfo, init: RequestInit = {}) {
const accessStore = useAccessStore();
const token = accessStore.accessToken;
const headers = new Headers(init.headers || {});
headers.append('Content-Type', 'application/json');
headers.append('Authorization', formatToken(token) as string);
return fetch(input, { ...init, headers });
}