diff --git a/src/routes/_authenticated.subscribe.tsx b/src/routes/_authenticated.subscribe.tsx index 3057ca9..cd0b126 100644 --- a/src/routes/_authenticated.subscribe.tsx +++ b/src/routes/_authenticated.subscribe.tsx @@ -1,7 +1,9 @@ import { createFileRoute, useNavigate } from "@tanstack/react-router"; import { AutumnProvider, useCustomer } from "autumn-js/react"; import { useEffect, useState } from "react"; -import { useSession } from "@/lib/auth-client"; +import { User } from "lucide-react"; +import { authClient, useSession } from "@/lib/auth-client"; +import { getSignInHrefForLocation } from "@/lib/auth-redirect"; import { getStandardErrorMessage } from "@/client/lib/error-messages"; import { getSubscribeRouteState } from "@/client/features/billing/route-state"; import { @@ -111,6 +113,7 @@ function SubscribePageContent() { return (
+
); } + +function SubscribePageAccountMenu({ + email, +}: { + email: string | undefined; +}) { + if (!email) return null; + + const handleSignOut = () => { + const signInHref = getSignInHrefForLocation(window.location); + void authClient.signOut({ + fetchOptions: { + onSuccess: () => { + window.location.assign(signInHref); + }, + }, + }); + }; + + return ( +
+
+ +
    +
  • + {email} +
  • +
  • + +
  • +
+
+
+ ); +}