switch to nx monorepo

This commit is contained in:
Philipinho
2024-01-09 18:58:26 +01:00
parent e1bb2632b8
commit 093e634c0b
273 changed files with 11419 additions and 31 deletions

View File

@ -0,0 +1,23 @@
import { useAtom } from 'jotai';
import { currentUserAtom } from '@/features/user/atoms/current-user-atom';
import React, { useEffect } from 'react';
import useCurrentUser from '@/features/user/hooks/use-current-user';
export function UserProvider({ children }: React.PropsWithChildren) {
const [, setCurrentUser] = useAtom(currentUserAtom);
const { data, isLoading, error } = useCurrentUser();
useEffect(() => {
if (data && data.user) {
setCurrentUser(data);
}
}, [data, isLoading, setCurrentUser]);
if (isLoading) return <></>;
if (error) {
return <>an error occurred</>;
}
return <>{children}</>;
}