ChemPal Documentation - v1.6.0
    Preparing search index...

    Function isAuthRequiredEndpoint

    • Validates if a URL requires authentication. These endpoints require a valid user token in the X-User-Token header.

      Parameters

      • url: string

        The API endpoint URL to check

      Returns boolean

      True if the endpoint requires authentication

      if (isAuthRequiredEndpoint('/api/center/order_list')) {
      // Add authentication headers
      }
      export function isAuthRequiredEndpoint(url: string): boolean {
      // TS narrows enum-value arrays to the enum union; widen to string[] so
      // .includes accepts an arbitrary string argument.
      return (Object.values(AuthRequiredEndpoints) as string[]).includes(url);
      }