Skip to content

Commit

Permalink
refactor: msw 관련 코드 제거
Browse files Browse the repository at this point in the history
  • Loading branch information
ienrum committed Jul 23, 2024
1 parent 549ec49 commit 72e0a95
Show file tree
Hide file tree
Showing 15 changed files with 20 additions and 847 deletions.
4 changes: 0 additions & 4 deletions .storybook/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import type { Preview } from '@storybook/react';
import { initialize, mswLoader } from 'msw-storybook-addon';

import '../src/app/globals.css';
import { handlers } from '../src/mocks/handlers';

initialize({ onUnhandledRequest: 'bypass' });
const preview: Preview = {
Expand All @@ -15,9 +14,6 @@ const preview: Preview = {
date: /Date$/i,
},
},
msw: {
handlers,
},
},
loaders: [mswLoader],
decorators: [
Expand Down
284 changes: 0 additions & 284 deletions public/mockServiceWorker.js

This file was deleted.

26 changes: 11 additions & 15 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@ import type { Viewport } from 'next';
import { ToastContainer } from 'react-toastify';
import 'react-toastify/dist/ReactToastify.css';

import AuthenticatedRoute from '@/src/app/AuthenticatedRoute';
import GoogleAnalytics from '@/src/components/GoogleAnalystics';

import Introduction from '../components/Introduction';
import { MSWComponent } from '../mocks/MSWComponent';
import { getMetadata } from '../utils/getMetadata';
import Providers from './Providers';
import './globals.css';
Expand All @@ -33,20 +31,18 @@ const RootLayout = ({
</head>
<body className='font-sans'>
<Providers>
<MSWComponent>
<div className='flex h-screen w-screen items-center justify-center gap-10'>
<div className='hidden shrink sm:flex'>
<Introduction />
</div>
<div
id='layout-Root'
className='relative flex h-full max-h-[950px] min-h-[600px] w-full min-w-[350px] max-w-[450px] shrink-0 flex-col bg-background text-white shadow-xl'
>
<AuthenticatedRoute>{children}</AuthenticatedRoute>
<ToastContainer className='absolute bottom-[103px] flex flex-col items-center justify-center' />
</div>
<div className='flex h-screen w-screen items-center justify-center gap-10'>
<div className='hidden shrink sm:flex'>
<Introduction />
</div>
</MSWComponent>
<div
id='layout-Root'
className='relative flex h-full max-h-[950px] min-h-[600px] w-full min-w-[350px] max-w-[450px] shrink-0 flex-col bg-background text-white shadow-xl'
>
{children}
<ToastContainer className='absolute bottom-[103px] flex flex-col items-center justify-center' />
</div>
</div>
</Providers>
</body>
</html>
Expand Down
10 changes: 9 additions & 1 deletion src/app/users/profile/(posting)/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

import { PropsWithChildren, Suspense } from 'react';

import { usePathname } from 'next/navigation';
import { usePathname, useRouter } from 'next/navigation';

import { useGetUserStatusAPI } from '@/src/apis/myInfo';
import Spinner from '@/src/components/Spinner';
import TopBar from '@/src/components/Topbar';

Expand All @@ -22,6 +23,13 @@ export type PostingNavigation =

const PostingLayout = ({ children }: PropsWithChildren) => {
const pathname = usePathname().split('/').pop() as PostingNavigation;
const router = useRouter();
const { login: isLogin } = useGetUserStatusAPI();

if (!isLogin) {
router.push('/signin');
return null;
}

return (
<>
Expand Down
12 changes: 0 additions & 12 deletions src/instrumentation.ts

This file was deleted.

Loading

0 comments on commit 72e0a95

Please sign in to comment.