import { initializeAuth, getToken } from "./auth.js";
import { log, error } from "./logger.js";

async function startApp() {
  log("App starting...");

  await initializeAuth();

  try {
    const token = await getToken();
    log("Final acquired token:", token.slice(0, 30) + "...");

    document.querySelector("#content").textContent =
      "Logged in successfully. Token acquired.";
  } catch (e) {
    error("Failed to authenticate:", e);
    document.querySelector("#content").textContent =
      "Authentication failed. Check console.";
  }
}

startApp();
