Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#212] Refactor: msw 관련 코드 제거 #213

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading