diff --git a/packages/template/src/components-page/auth-page.tsx b/packages/template/src/components-page/auth-page.tsx index 4fa0c2458..09779c3ca 100644 --- a/packages/template/src/components-page/auth-page.tsx +++ b/packages/template/src/components-page/auth-page.tsx @@ -69,6 +69,7 @@ function Inner (props: Props) { const project = props.mockProject || projectFromHook; const { t } = useTranslation(); + useEffect(() => { if (props.automaticRedirect) { if (user && !props.mockProject) { diff --git a/packages/template/src/components/oauth-button.tsx b/packages/template/src/components/oauth-button.tsx index 204d26e01..3fef74dde 100644 --- a/packages/template/src/components/oauth-button.tsx +++ b/packages/template/src/components/oauth-button.tsx @@ -2,7 +2,7 @@ import { BrandIcons, Button } from '@stackframe/stack-ui'; import Color from 'color'; -import { useId } from 'react'; +import { useEffect, useId, useState } from 'react'; import { useStackApp } from '..'; import { useTranslation } from '../lib/translations'; @@ -26,6 +26,11 @@ export function OAuthButton({ const stackApp = useStackApp(); const styleId = useId().replaceAll(':', '-'); + const [lastUsed, setLastUsed] = useState(null); + useEffect(() => { + setLastUsed(localStorage.getItem('_STACK_AUTH.lastUsed')); + }, []); + let style : { backgroundColor?: string, textColor?: string, @@ -161,9 +166,17 @@ export function OAuthButton({ <>