feat: rewrite auth (#364)
* feat: wip rewrite auth * feat: restructure folders and fix stories and tests * feat: remove auth provider and fix tests
This commit is contained in:
@ -1,22 +1,34 @@
|
||||
import { MemoryRouter } from 'react-router-dom';
|
||||
import { ApolloProvider } from '@apollo/client';
|
||||
import { ThemeProvider } from '@emotion/react';
|
||||
import { RecoilRoot } from 'recoil';
|
||||
import { RecoilRoot, useRecoilState } from 'recoil';
|
||||
|
||||
import { currentUserState } from '@/auth/states/currentUserState';
|
||||
import { isAuthenticatingState } from '@/auth/states/isAuthenticatingState';
|
||||
import { darkTheme } from '@/ui/layout/styles/themes';
|
||||
import { App } from '~/App';
|
||||
import { AuthProvider } from '~/providers/AuthProvider';
|
||||
import { FullHeightStorybookLayout } from '~/testing/FullHeightStorybookLayout';
|
||||
import { mockedUsersData } from '~/testing/mock-data/users';
|
||||
import { mockedClient } from '~/testing/mockedClient';
|
||||
|
||||
export const render = () => renderWithDarkMode(false);
|
||||
|
||||
const MockedAuth: React.FC<React.PropsWithChildren> = ({ children }) => {
|
||||
const [, setCurrentUser] = useRecoilState(currentUserState);
|
||||
const [, setIsAuthenticating] = useRecoilState(isAuthenticatingState);
|
||||
|
||||
setCurrentUser(mockedUsersData[0]);
|
||||
setIsAuthenticating(false);
|
||||
|
||||
return <>{children}</>;
|
||||
};
|
||||
|
||||
export const renderWithDarkMode = (forceDarkMode?: boolean) => {
|
||||
const AppInStoryBook = (
|
||||
<FullHeightStorybookLayout>
|
||||
<AuthProvider>
|
||||
<MockedAuth>
|
||||
<App />
|
||||
</AuthProvider>
|
||||
</MockedAuth>
|
||||
</FullHeightStorybookLayout>
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user