-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
349 additions
and
55 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,3 +1,5 @@ | ||
'use client' | ||
|
||
import Image from 'next/image' | ||
import React, { ReactNode } from 'react' | ||
|
||
|
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,9 +1,118 @@ | ||
import React, { ReactNode } from 'react' | ||
'use client' | ||
|
||
import { useRouter } from 'next/navigation' | ||
import { useSession } from 'next-auth/react' | ||
import React, { ReactNode, useState } from 'react' | ||
|
||
import { TextDivider } from '@/components/common/Dividers' | ||
import { Button } from '@/components/ui/button' | ||
import { Checkbox } from '@/components/ui/checkbox' | ||
import { ClientModalData } from '@/lib/constants/errors' | ||
import { BACKEND_ROUTES } from '@/lib/constants/routes' | ||
import useModal from '@/lib/utils/hooks/useModal' | ||
import { useToast } from '@/lib/utils/hooks/useToast' | ||
|
||
interface SignOutPageProps {} | ||
|
||
const SignOutPage = ({}: SignOutPageProps): ReactNode => { | ||
return <div>SignOutPage</div> | ||
const { modalData, handleModalStates, Modal } = useModal() | ||
const session: any = useSession() | ||
const router = useRouter() | ||
const [isChecked, setIsChecked] = useState<boolean>(false) | ||
const { toast } = useToast() | ||
|
||
const signOut = async () => { | ||
if (!isChecked) { | ||
console.log('431') | ||
|
||
toast({ title: '주의사항에 동의해주세요.' }) | ||
return | ||
} | ||
|
||
const url = BACKEND_ROUTES.AUTH.SIGNOUT | ||
try { | ||
const res = await fetch(`/server${url.url}`, { | ||
method: url.method, | ||
headers: { | ||
Authorization: session.data.accessToken, | ||
'Content-Type': 'application/json', | ||
}, | ||
credentials: 'include', | ||
}) | ||
|
||
const status = res.status | ||
if (res.ok) { | ||
handleModalStates( | ||
{ | ||
id: 'info', | ||
title: '회원 탈퇴', | ||
description: '회원 탈퇴가 완료되었습니다.', | ||
isError: false, | ||
}, | ||
'open', | ||
) | ||
|
||
return | ||
} | ||
switch (status) { | ||
default: | ||
handleModalStates(ClientModalData.serverError, 'open') | ||
return | ||
} | ||
} catch (error) { | ||
handleModalStates(ClientModalData.serverError, 'open') | ||
} | ||
} | ||
|
||
return ( | ||
<div className='w-3/4 xl:w-3/5 2xl:w-1/2'> | ||
<div className='my-10 flex items-center justify-center'> | ||
<TextDivider text='회원탈퇴' /> | ||
</div> | ||
<div className='flex flex-col items-center text-center text-lg'> | ||
<h1 className='mb-4 text-3xl'>TraBook과 함께했던</h1> | ||
<h1 className='mb-4 text-3xl'>소중한 여행 기록들을 간직해주세요!</h1> | ||
<ul className='max-w-[450px] list-disc text-start'> | ||
<li className='my-4'>서비스 이용 정보 (내 계힉, 보관함 등)은 모두 삭제됩니다.</li> | ||
<li className='my-4'>기록된 리뷰 및 댓글은 삭제되지 않습니다.</li> | ||
<li className='my-4'>회원가입 탈퇴 시 계정 정보는 영구 삭제됩니다.</li> | ||
</ul> | ||
<div className='my-6 flex max-w-[500px] items-center'> | ||
<Checkbox | ||
id='signup' | ||
className='h-5 w-5 border-tbGray data-[state=checked]:bg-tbSecondary data-[state=checked]:text-tbPrimary' | ||
checked={isChecked} | ||
onClick={() => setIsChecked(prev => !prev)} | ||
/> | ||
<label | ||
htmlFor='signup' | ||
className='grow pl-2 text-lg font-normal leading-5 peer-disabled:cursor-not-allowed peer-disabled:opacity-70' | ||
> | ||
위 주의사항을 모두 숙제하였으며, 탈퇴에 동의합니다. | ||
</label> | ||
</div> | ||
</div> | ||
<div className='my-7 flex w-full gap-3'> | ||
<Button variant='tbRed' className='h-14 w-1/2 text-lg' onClick={signOut}> | ||
탈퇴하기 | ||
</Button> | ||
<Button | ||
variant='tbPrimary' | ||
className='h-14 w-1/2 text-lg' | ||
onClick={() => { | ||
router.back() | ||
}} | ||
> | ||
함께하기 | ||
</Button> | ||
<Modal | ||
onConfirm={() => { | ||
router.push('/') | ||
}} | ||
/> | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
export default SignOutPage |
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
'use client' | ||
|
||
import { useRouter } from 'next/navigation' | ||
import React, { ReactNode, useEffect } from 'react' | ||
|
||
import useModal from '@/lib/utils/hooks/useModal' | ||
|
||
interface CompanionPageProps {} | ||
|
||
const CompanionPage = ({}: CompanionPageProps): ReactNode => { | ||
const router = useRouter() | ||
const { modalData, handleModalStates, Modal } = useModal() | ||
|
||
useEffect(() => { | ||
handleModalStates( | ||
{ | ||
id: 'info', | ||
title: '동행 구하기', | ||
description: '서비스 준비 중입니다.', | ||
isError: false, | ||
}, | ||
'open', | ||
) | ||
}, []) | ||
|
||
return ( | ||
<> | ||
<Modal | ||
onConfirm={() => { | ||
router.replace('/login') | ||
}} | ||
/> | ||
</> | ||
) | ||
} | ||
|
||
export default CompanionPage |
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
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
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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import React, { ReactNode } from 'react' | ||
|
||
import { cn } from '@/lib/utils/cn' | ||
import useModal from '@/lib/utils/hooks/useModal' | ||
|
||
interface PasswordFindLinkProps { | ||
className?: string | ||
} | ||
|
||
const PasswordFindLink = ({ className }: PasswordFindLinkProps): ReactNode => { | ||
const { modalData, handleModalStates, Modal } = useModal() | ||
const openModal = () => { | ||
handleModalStates( | ||
{ | ||
id: 'info', | ||
title: '비밀번호 찾기', | ||
description: '서비스 준비 중입니다.\nTraBook 이메일로 문의해주세요.', | ||
isError: false, | ||
}, | ||
'open', | ||
) | ||
} | ||
|
||
return ( | ||
<div className={cn('flex flex-col items-center justify-center gap-3 ssm:flex-row', className)}> | ||
<p className='text-tbGray'>비밀번호를 잊으셨나요?</p> | ||
{/* <Link className='text-black underline hover:text-tbBlue' href={ROUTES.AUTH.SIGNUP.url}> | ||
비밀번호 찾기 | ||
</Link> */} | ||
<div className='text-black underline hover:text-tbBlue' onClick={openModal}> | ||
비밀번호 찾기 | ||
</div> | ||
<Modal onConfirm={() => {}} /> | ||
</div> | ||
) | ||
} | ||
|
||
export default PasswordFindLink |
Oops, something went wrong.