ChemPal Documentation - v0.0.13-beta.5
    Preparing search index...
    • Validates that a response matches the ATGResponse interface structure.

      Parameters

      • obj: unknown

        Response object to validate

      Returns obj is ATGResponse

      Type predicate indicating if object is a valid ATGResponse

      const response = await this.httpGetJson({
      path: `/api/rest/cb/product/product-quick-view/${productId}`
      });
      if (isATGResponse(response)) {
      // Process valid ATG response
      console.log(response.response.response.products[0]);
      }
      export function isATGResponse(obj: unknown): obj is ATGResponse {
      return atgResponseSchema.safeParse(obj).success;
      }