From cc272aaf0a3c21e1912ed5904d6746f667c48a68 Mon Sep 17 00:00:00 2001 From: Heather Yu <35639529+hetd54@users.noreply.github.com> Date: Mon, 26 Aug 2024 13:54:45 -0400 Subject: [PATCH] fix: script tags for accessing window on client for astro --- src/pages/api/auth.astro | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/pages/api/auth.astro b/src/pages/api/auth.astro index 44add1c..ba9f176 100644 --- a/src/pages/api/auth.astro +++ b/src/pages/api/auth.astro @@ -3,17 +3,19 @@ import Layout from "../../layouts/Layout.astro" import { GET } from "./auth" const auth = await GET(Astro.url.origin) - -const receiveMessage = (message: MessageEvent) => { - window.opener.postMessage( - "authorization:github:${status}:${JSON.stringify(content)}", - message.origin - ) - window.removeEventListener("message", receiveMessage, false) -} -window.addEventListener("message", receiveMessage, false) - -window.opener.postMessage("authorizing:github", "*") --- + +