ChemPal Documentation - v0.0.13-beta.5
    Preparing search index...

    Function setCookie

    • Writes a cookie into the browser cookie jar so the storefront returns it on subsequent requests made with credentials: "include". No-ops with a warning when the API is unavailable, and swallows write failures (logging them) so a failed seed never aborts the surrounding query.

      Parameters

      • details: SetDetails

        The chrome.cookies.set details (url, name, value, etc.)

      Returns Promise<void>

      A promise that resolves once the write has been attempted

      await setCookie({ url: "https://shop.es-drei.de", name: "currency", value: "2" });
      
      export async function setCookie(details: chrome.cookies.SetDetails): Promise<void> {
      if (!isCookiesApiAvailable()) {
      logger.warn("chrome.cookies unavailable; skipping cookie set", { details });
      return;
      }
      try {
      await chrome.cookies.set(details);
      } catch (error: unknown) {
      logger.warn("Failed to set cookie", { details, error });
      }
      }