-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Feat/#81/naver analytics(swm 360)
- Loading branch information
Showing
20 changed files
with
260 additions
and
156 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,28 @@ | ||
'use client'; | ||
import { API_FETCH_ERROR, ErrorMessage } from '@/src/api/ErrorMessage'; | ||
import { API_FETCH_ERROR, ErrorMessage, SESSION_ERROR } from '@/src/api/ErrorMessage'; | ||
import useAuth from '@/src/hooks/useAuth'; | ||
import setErrorToast from '@/src/util/toast/setErrorToast'; | ||
import { useRouter } from 'next/navigation'; | ||
import { useEffect } from 'react'; | ||
|
||
export default function ErrorHandler({ | ||
export default async function ErrorHandler({ | ||
error, | ||
reset | ||
}: { | ||
error: Error; | ||
reset: () => void; | ||
}) { | ||
const router = useRouter(); | ||
const { logout } = useAuth(); | ||
|
||
useEffect(() => { | ||
if (error.cause === API_FETCH_ERROR) { | ||
setErrorToast(error); | ||
router.back(); | ||
} else if (error.cause === SESSION_ERROR) { | ||
setErrorToast(error); | ||
await logout(); | ||
} else { | ||
setErrorToast(new Error(ErrorMessage.DEFAULT)); | ||
} | ||
return () => router.refresh(); | ||
}, [error, router]); | ||
|
||
return null; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export default function Default() { | ||
return null; | ||
} | ||
return <></>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,31 @@ | ||
import React from 'react' | ||
'use client'; | ||
import LoginButton from '@/src/components/login/LoginButton'; | ||
import Button from '@/src/components/ui/button/Button'; | ||
import { useRouter } from 'next/navigation'; | ||
|
||
type Props = {} | ||
export default function Signin({}) { | ||
const router = useRouter(); | ||
|
||
export default function Signin({}: Props) { | ||
return ( | ||
<div>Signin</div> | ||
) | ||
} | ||
<div className='flex bg-sroom-gray-200'> | ||
<div className='max-w-[400px] mx-auto pt-60 pb-96'> | ||
<h2 className='flex flex-col gap-2 mb-8 text-3xl font-bold text-sroom-black-400'> | ||
<p>{'스룸의 기능은 로그인을 해야'}</p> | ||
<p>{'이용하실 수 있어요 :)'}</p> | ||
</h2> | ||
<h3 className='mb-16 text-lg font-medium text-sroom-black-100'> | ||
{'구글 로그인으로 간편하게 스룸을 이용해보세요!'} | ||
</h3> | ||
<LoginButton className='mb-5' buttonWidth={400} /> | ||
<Button | ||
className='w-full text-sroom-white bg-sroom-brand' | ||
onClick={() => { | ||
router.replace('/'); | ||
}} | ||
> | ||
홈으로 가기 | ||
</Button> | ||
</div> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,35 @@ | ||
import React from 'react' | ||
'use client'; | ||
import Button from '@/src/components/ui/button/Button'; | ||
import useAuth from '@/src/hooks/useAuth'; | ||
import { useRouter } from 'next/navigation'; | ||
|
||
type Props = {} | ||
export default function Signout({}) { | ||
const router = useRouter(); | ||
const { logout } = useAuth(); | ||
|
||
export default function Signout({}: Props) { | ||
return ( | ||
<div>Signout</div> | ||
) | ||
} | ||
<div className='flex bg-sroom-gray-200'> | ||
<div className='max-w-md mx-auto pt-60 pb-96'> | ||
<h2 className='flex flex-col gap-2 mb-8 text-3xl font-bold text-sroom-black-400'> | ||
<p>{'지금 로그아웃 하시면'}</p> | ||
<p>{'스룸의 기능을 이용하실 수 없어요! :('}</p> | ||
</h2> | ||
<h3 className='mb-16 text-lg font-medium text-sroom-black-100'> | ||
{'이용 중이시던 서비스를 계속해서 즐겨보세요'} | ||
</h3> | ||
<Button | ||
className='w-full mb-5 text-sroom-white bg-sroom-brand' | ||
onClick={router.back} | ||
> | ||
돌아가기 | ||
</Button> | ||
<Button | ||
className='w-full border text-sroom-black-400 bg-sroom-white border-sroom-gray-500' | ||
onClick={logout} | ||
> | ||
로그아웃 하기 | ||
</Button> | ||
</div> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,31 @@ | ||
'use client'; | ||
import { API_FETCH_ERROR, ErrorMessage } from '@/src/api/ErrorMessage'; | ||
import { | ||
API_FETCH_ERROR, | ||
ErrorMessage, | ||
SESSION_ERROR | ||
} from '@/src/api/ErrorMessage'; | ||
import useAuth from '@/src/hooks/useAuth'; | ||
import setErrorToast from '@/src/util/toast/setErrorToast'; | ||
import { useRouter } from 'next/navigation'; | ||
import { useEffect } from 'react'; | ||
|
||
export default function ErrorHandler({ | ||
export default async function ErrorHandler({ | ||
error, | ||
reset | ||
}: { | ||
error: Error; | ||
reset: () => void; | ||
}) { | ||
const router = useRouter(); | ||
const { logout } = useAuth(); | ||
|
||
useEffect(() => { | ||
if (error.cause === API_FETCH_ERROR) { | ||
setErrorToast(error); | ||
} else { | ||
setErrorToast(new Error(ErrorMessage.DEFAULT)); | ||
} | ||
return () => router.refresh(); | ||
}, [error, router]); | ||
if (error.cause === API_FETCH_ERROR) { | ||
setErrorToast(error); | ||
} else if (error.cause === SESSION_ERROR) { | ||
setErrorToast(error); | ||
await logout(); | ||
} else { | ||
setErrorToast(new Error(ErrorMessage.DEFAULT)); | ||
} | ||
|
||
return null; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,32 @@ | ||
'use client'; | ||
import setErrorToast from '@/src/util/toast/setErrorToast'; | ||
import { useRouter } from 'next/navigation'; | ||
import { useEffect } from 'react'; | ||
import { API_FETCH_ERROR, ErrorMessage } from '../api/ErrorMessage'; | ||
import { | ||
API_FETCH_ERROR, | ||
ErrorMessage, | ||
SESSION_ERROR | ||
} from '../api/ErrorMessage'; | ||
import useAuth from '../hooks/useAuth'; | ||
|
||
export default function ErrorHandler({ | ||
export default async function ErrorHandler({ | ||
error, | ||
reset | ||
}: { | ||
error: Error; | ||
reset: () => void; | ||
}) { | ||
const router = useRouter(); | ||
const { logout } = useAuth(); | ||
|
||
useEffect(() => { | ||
if (error.cause === API_FETCH_ERROR) { | ||
setErrorToast(error); | ||
router.back(); | ||
} else { | ||
setErrorToast(new Error(ErrorMessage.DEFAULT)); | ||
} | ||
return () => router.refresh(); | ||
}, [error, router]); | ||
if (error.cause === API_FETCH_ERROR) { | ||
setErrorToast(error); | ||
router.back(); | ||
} else if (error.cause === SESSION_ERROR) { | ||
setErrorToast(error); | ||
await logout(); | ||
} else { | ||
setErrorToast(new Error(ErrorMessage.DEFAULT)); | ||
} | ||
|
||
return null; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,33 @@ | ||
'use client'; | ||
import { API_FETCH_ERROR, ErrorMessage } from '@/src/api/ErrorMessage'; | ||
import { | ||
API_FETCH_ERROR, | ||
ErrorMessage, | ||
SESSION_ERROR | ||
} from '@/src/api/ErrorMessage'; | ||
import useAuth from '@/src/hooks/useAuth'; | ||
import setErrorToast from '@/src/util/toast/setErrorToast'; | ||
import { useRouter } from 'next/navigation'; | ||
import { useEffect } from 'react'; | ||
|
||
export default function ErrorHandler({ | ||
export default async function ErrorHandler({ | ||
error, | ||
reset | ||
}: { | ||
error: Error; | ||
reset: () => void; | ||
}) { | ||
const router = useRouter(); | ||
const { logout } = useAuth(); | ||
|
||
useEffect(() => { | ||
if (error.cause === API_FETCH_ERROR) { | ||
setErrorToast(error); | ||
router.replace('/'); | ||
router.refresh(); | ||
} else { | ||
setErrorToast(new Error(ErrorMessage.DEFAULT)); | ||
} | ||
return () => router.refresh(); | ||
}, [error, router]); | ||
if (error.cause === API_FETCH_ERROR) { | ||
setErrorToast(error); | ||
router.replace('/'); | ||
router.refresh(); | ||
} else if (error.cause === SESSION_ERROR) { | ||
setErrorToast(error); | ||
await logout(); | ||
} else { | ||
setErrorToast(new Error(ErrorMessage.DEFAULT)); | ||
} | ||
|
||
return null; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.