feat: implement useAuthToken hook for consistent auth token retrieval across components.comment from nati

This commit is contained in:
estifanos
2026-08-14 09:27:37 +00:00
parent accfb8c95d
commit 7c79f4d644
5 changed files with 25 additions and 12 deletions

View File

@@ -1,13 +1,12 @@
import Cookies from 'js-cookie';
import { LandingPage } from '@ema-platform/ui';
import { authStorage } from '@ema-platform/auth';
import { useAuthToken } from '@ema-platform/auth';
/**
* Public `/` — mounts the shared landing page. Backoffice has no /signup
* (enableSignup: false) and no /verify route, so those props are omitted.
*/
export function LandingRoute() {
const token = authStorage.getToken() ?? Cookies.get('auth-token');
const token = useAuthToken();
return <LandingPage primaryHref={token ? '/dashboard' : '/login'} />;
}