mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-14 13:25:12 +00:00
fix(admin): unable to log into admin panel (#11451)
This commit is contained in:
25
packages/frontend/admin/src/fetch-utils.ts
Normal file
25
packages/frontend/admin/src/fetch-utils.ts
Normal 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,
|
||||
},
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user