---
import MediaRequestForm from "@/components/TRip/MediaRequestForm"
import Base from "@/layouts/Base.astro";
import Root from "@/components/AppLayout.jsx";
import { verifyToken } from "@/utils/jwt";

const token = Astro.cookies.get("access_token")?.value;
let user = null;

try {
  if (token) {
    user = verifyToken(token);
    if (user) {
      console.log("Verified!", user);
    } else {
      throw Error("Authentication required");
    }
  } else {
    throw Error("Authentication required");
  }
} catch {
    return Astro.redirect('/login'
  );
}
---
<Base>
  <section>
  <div class="prose prose-neutral dark:prose-invert">
  <Root child="qs2.RequestManagement" client:only="react">
  </Root>
  </section>
</Base>
