"use client";
import * as React from "react";
import { apiCall } from "./apiCall.js";
function useCurrentUserId() {
  const [userId, setUserId] = React.useState("");
  React.useEffect(() => {
    let cancelled = false;
    void (async () => {
      try {
        const res = await apiCall("/api/auth/feature-check", {
          method: "POST",
          headers: { "content-type": "application/json" },
          body: JSON.stringify({ features: [] })
        });
        if (!cancelled && res.ok && typeof res.result?.userId === "string") {
          setUserId(res.result.userId);
        }
      } catch {
        if (!cancelled) setUserId("");
      }
    })();
    return () => {
      cancelled = true;
    };
  }, []);
  return userId;
}
export {
  useCurrentUserId
};
//# sourceMappingURL=useCurrentUserId.js.map
