fix(admin): unable to log into admin panel (#11451)

This commit is contained in:
JimmFly
2025-04-04 10:39:20 +00:00
parent eed26b1601
commit 3ecdc377fe
4 changed files with 32 additions and 4 deletions

View File

@@ -0,0 +1,25 @@
/**
* Custom fetch utility with AFFiNE version header
* Automatically adds the x-affine-version header to all fetch requests
*/
// BUILD_CONFIG is defined globally in the AFFiNE project
/**
* Wrapper around fetch that automatically adds the x-affine-version header
* @param input Request URL
* @param init Request initialization options
* @returns Promise with the fetch Response
*/
export const affineFetch = (
input: RequestInfo | URL,
init?: RequestInit
): Promise<Response> => {
return fetch(input, {
...init,
headers: {
...init?.headers,
'x-affine-version': BUILD_CONFIG.appVersion,
},
});
};