Add Auth Index page (#323)
This commit is contained in:
@ -3,7 +3,7 @@ import { useNavigate, useSearchParams } from 'react-router-dom';
|
||||
|
||||
import { getTokensFromLoginToken } from '@/auth/services/AuthService';
|
||||
|
||||
export function AuthCallback() {
|
||||
export function Callback() {
|
||||
const [searchParams] = useSearchParams();
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
|
||||
26
front/src/pages/auth/Index.tsx
Normal file
26
front/src/pages/auth/Index.tsx
Normal file
@ -0,0 +1,26 @@
|
||||
import { useEffect } from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
|
||||
import { useMockData } from '@/auth/hooks/useMockData';
|
||||
import { hasAccessToken } from '@/auth/services/AuthService';
|
||||
import { Modal } from '@/ui/components/modal/Modal';
|
||||
|
||||
import { Companies } from '../companies/Companies';
|
||||
|
||||
export function Index() {
|
||||
const navigate = useNavigate();
|
||||
useMockData();
|
||||
|
||||
useEffect(() => {
|
||||
if (hasAccessToken()) {
|
||||
navigate('/');
|
||||
}
|
||||
}, [navigate]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Companies />
|
||||
<Modal>Welcome to Twenty</Modal>
|
||||
</>
|
||||
);
|
||||
}
|
||||
22
front/src/pages/auth/__stories__/Index.stories.tsx
Normal file
22
front/src/pages/auth/__stories__/Index.stories.tsx
Normal file
@ -0,0 +1,22 @@
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
|
||||
import { graphqlMocks } from '~/testing/graphqlMocks';
|
||||
import { getRenderWrapperForPage } from '~/testing/renderWrappers';
|
||||
|
||||
import { Index } from '../Index';
|
||||
|
||||
const meta: Meta<typeof Index> = {
|
||||
title: 'Pages/Auth/Index',
|
||||
component: Index,
|
||||
};
|
||||
|
||||
export default meta;
|
||||
|
||||
export type Story = StoryObj<typeof Index>;
|
||||
|
||||
export const Default: Story = {
|
||||
render: getRenderWrapperForPage(<Index />, '/auth'),
|
||||
parameters: {
|
||||
msw: graphqlMocks,
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user