mock create drawing
This commit is contained in:
@@ -1,11 +1,14 @@
|
||||
import { formatToken } from '#/utils/auth';
|
||||
import { useAccessStore } from '@vben/stores';
|
||||
|
||||
import { formatToken } from '#/utils/auth';
|
||||
|
||||
export const API_BASE = '/api/ai/v1/';
|
||||
|
||||
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 });
|
||||
return fetch(API_BASE + input, { ...init, headers });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user