From 1afad8f63c1716a48bda1f4381aec8fea60f1d03 Mon Sep 17 00:00:00 2001 From: Morgan Roderick Date: Sat, 10 Oct 2026 10:21:50 +0200 Subject: [PATCH] chore: remove unused static/auth-client.js The browser Better Auth client module has no live call sites: the sign-in flow is server-rendered (GitHubButton posts /login/github, MagicLinkButton targets /login/magic-link), and no component, test, or e2e run references the module or its exports. Its esm.sh @latest import was a version-drift hazard reachable by every page load; remove it and the layout script tag. --- src/app/components/layout.js | 4 ---- static/auth-client.js | 32 -------------------------------- 2 files changed, 36 deletions(-) delete mode 100644 static/auth-client.js diff --git a/src/app/components/layout.js b/src/app/components/layout.js index b922bae..c1e9397 100644 --- a/src/app/components/layout.js +++ b/src/app/components/layout.js @@ -44,10 +44,6 @@ export const Layout = ({ title, children, hideNav }) => html` : "" }
${children}
- diff --git a/static/auth-client.js b/static/auth-client.js deleted file mode 100644 index 4093881..0000000 --- a/static/auth-client.js +++ /dev/null @@ -1,32 +0,0 @@ -// TODO: we need a bundler, so we can re-use what we have in node_modules already -import { createAuthClient } from "https://esm.sh/better-auth@latest/client"; - -export const authClient = createAuthClient({ - baseURL: window.location.origin, - plugins: [], -}); - -export const { signIn, signUp } = authClient; - -const handleGitHubSignIn = async (event) => { - event.preventDefault(); - const button = event.target; - const redirectUrl = button.dataset.redirectUrl || "/profile"; - - try { - await authClient.signIn.social({ - provider: "github", - callbackURL: redirectUrl, - }); - } catch (error) { - console.error("GitHub sign in failed:", error); - window.location.href = - "/login?error=" + - encodeURIComponent("GitHub sign in failed: " + error.message); - } -}; - -// Attach event listeners when DOM is loaded -document.addEventListener("DOMContentLoaded", () => { - window.handleGitHubSignIn = handleGitHubSignIn; -});