fix: always init Zero when user exists, pass auth as optional

This commit is contained in:
CREDO23 2026-03-24 16:39:37 +02:00
parent 5c98f1c717
commit 54ffdc5aad

View file

@ -42,15 +42,14 @@ function ZeroAuthGuard({ children }: { children: React.ReactNode }) {
export function ZeroProvider({ children }: { children: React.ReactNode }) {
const { data: user } = useAtomValue(currentUserAtom);
const token = getBearerToken();
if (!user?.id || !token) {
if (!user?.id) {
return <>{children}</>;
}
const userID = String(user.id);
const context = { userId: userID };
const auth = token;
const auth = getBearerToken() || undefined;
return (
<ZeroReactProvider {...{ userID, context, cacheURL, schema, queries, auth }}>