Settings - WIP

* User account settings
* Workspace settings
* Workspace membership management
*
This commit is contained in:
Philipinho
2023-09-04 19:43:06 +01:00
parent 03a9b81a80
commit 60c6452f9b
23 changed files with 880 additions and 36 deletions
+9 -9
View File
@@ -1,25 +1,25 @@
"use client"
'use client';
import { useAtom } from "jotai";
import { currentUserAtom } from "@/features/user/atoms/current-user-atom";
import { useEffect } from "react";
import useCurrentUser from "@/features/user/hooks/use-current-user";
import { useAtom } from 'jotai';
import { currentUserAtom } from '@/features/user/atoms/current-user-atom';
import { 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){
if (data && data.user) {
setCurrentUser(data);
}
}, [data, isLoading, setCurrentUser]);
if (isLoading) return <></>;
if (error){
return <>an error occurred</>
if (error) {
return <>an error occurred</>;
}
return <>{children}</>
return <>{children}</>;
}