Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

640 B
Raw Blame
/**
 * 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,
    },
  });
};