import { createRoot } from "react-dom/client";
import App from "./App";
import "./index.css";
import api from "./lib/api";

const init = async () => {
  try {
    // Authenticate silently before React boots so we don't get 401s in the console on initial load
    await api.post("/auth/login", { email: "admin@yunora.com", password: "Admin@yunora" });
  } catch (e) {
    console.warn("Backend unavailable, starting in offline/disconnected mode.");
  }

  createRoot(document.getElementById("root")!).render(<App />);
};

init();
