From c9fd46feac0d6cd8d1d61b7d7cfded8a92c5ff32 Mon Sep 17 00:00:00 2001 From: Heather Yu <35639529+hetd54@users.noreply.github.com> Date: Wed, 18 Sep 2024 13:24:14 -0400 Subject: [PATCH] test: auth-astro sign in on index page --- astro.config.mjs | 22 +++++++++++----------- public/admin/config.js | 11 +++++++++++ public/admin/index.html | 10 ++++++++-- 3 files changed, 30 insertions(+), 13 deletions(-) diff --git a/astro.config.mjs b/astro.config.mjs index bce04b2..4609d14 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -1,18 +1,18 @@ -import { defineConfig } from "astro/config"; -import mdx from "@astrojs/mdx"; -import sitemap from "@astrojs/sitemap"; -import tailwind from "@astrojs/tailwind"; -import react from "@astrojs/react"; -import auth from "auth-astro"; +import { defineConfig } from "astro/config" +import mdx from "@astrojs/mdx" +import sitemap from "@astrojs/sitemap" +import tailwind from "@astrojs/tailwind" +import react from "@astrojs/react" +import auth from "auth-astro" -import node from "@astrojs/node"; +import node from "@astrojs/node" // https://astro.build/config export default defineConfig({ site: "https://example.com", - output: "hybrid", + output: "server", integrations: [mdx(), sitemap(), tailwind(), react(), auth()], adapter: node({ - mode: "standalone" - }) -}); \ No newline at end of file + mode: "standalone", + }), +}) \ No newline at end of file diff --git a/public/admin/config.js b/public/admin/config.js index afd8a03..d4579a9 100644 --- a/public/admin/config.js +++ b/public/admin/config.js @@ -1,6 +1,17 @@ +import { signIn } from "../../node_modules/auth-astro/client.ts" import { PeoplePreview } from "./previews/PeoplePreview.js" import { NewsPreview } from "./previews/NewsPreview.js" +console.log("HI WE ARE HERE DOING THINGS") + +if (document.body.contains(document.querySelector(".CMS_Login_button"))) { + console.log("IT IS HERE") +} +document.getElementsByTagName("button").onclick = () => { + signIn("github") + console.log("overriding") +} +window.CMS.registerBackend("astro-auth") window.CMS.init() window.CMS.registerPreviewStyle("../src/styles/global.css") diff --git a/public/admin/index.html b/public/admin/index.html index c0f08e0..84a684d 100644 --- a/public/admin/index.html +++ b/public/admin/index.html @@ -9,11 +9,17 @@ Content Manager + + + \ No newline at end of file