Skip to content

Commit ee9bfb1

Browse files
committed
Merge remote-tracking branch 'origin/dev' into feat/recipeSearch#22
2 parents 0ea8b3e + 189226e commit ee9bfb1

File tree

36 files changed

+633
-118
lines changed

36 files changed

+633
-118
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// import CommentList from '@/domains/shared/components/comment/CommentList';
1+
import MyComment from '@/domains/mypage/components/pages/my-active/MyComment';
22
import { Metadata } from 'next';
33

44
export const metadata: Metadata = {
@@ -7,6 +7,6 @@ export const metadata: Metadata = {
77
};
88

99
function Page() {
10-
return <>{/* <CommentList /> */}</>;
10+
return <MyComment />;
1111
}
1212
export default Page;
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// import PostCard from '@/domains/community/main/PostCard';
2+
import MyLike from '@/domains/mypage/components/pages/my-active/MyLike';
23
import { Metadata } from 'next';
34

45
export const metadata: Metadata = {
@@ -7,6 +8,6 @@ export const metadata: Metadata = {
78
};
89

910
function Page() {
10-
return <section>{/* <PostCard posts={posts} isLoading={isLoading} /> */}</section>;
11+
// return <MyLike />;
1112
}
1213
export default Page;
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// import PostCard from '@/domains/community/main/PostCard';
1+
import MyPost from '@/domains/mypage/components/pages/my-active/MyPost';
22
import { Metadata } from 'next';
33

44
export const metadata: Metadata = {
@@ -7,6 +7,6 @@ export const metadata: Metadata = {
77
};
88

99
function Page() {
10-
return <div>{/* <PostCard posts={posts} isLoading={isLoading} /> */}</div>;
10+
return <MyPost />;
1111
}
1212
export default Page;

src/app/mypage/my-alarm/page.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import Alarm from '@/domains/mypage/components/Alarm';
1+
import MyAlarm from '@/domains/mypage/components/pages/my-alarm/MyAlarm';
22

33
import { Metadata } from 'next';
44

@@ -10,10 +10,7 @@ export const metadata: Metadata = {
1010
function Page() {
1111
return (
1212
<div className="flex flex-col gap-3">
13-
<Alarm></Alarm>
14-
<Alarm></Alarm>
15-
<Alarm></Alarm>
16-
<Alarm></Alarm>
13+
<MyAlarm />
1714
</div>
1815
);
1916
}

src/app/mypage/my-bar/page.tsx

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import CocktailCard from '@/domains/shared/components/cocktail-card/CocktailCard';
1+
import MyBar from '@/domains/mypage/components/pages/my-bar/MyBar';
22
import { Metadata } from 'next';
33

44
export const metadata: Metadata = {
@@ -7,19 +7,6 @@ export const metadata: Metadata = {
77
};
88

99
function Page() {
10-
return (
11-
<div
12-
className="grid grid-cols-1 justify-items-center mt-10 gap-8 sm:[grid-template-columns:repeat(2,minmax(0,320px))] sm:justify-evenly md:[grid-template-columns:repeat(3,minmax(0,250px))]
13-
"
14-
>
15-
<CocktailCard
16-
src=""
17-
textSize1="text-xl"
18-
name="Old Pashioned"
19-
nameKo="올드 패션드"
20-
keep={false}
21-
></CocktailCard>
22-
</div>
23-
);
10+
return <MyBar />;
2411
}
2512
export default Page;

src/app/recommend/page.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
1+
'use client';
2+
13
import ChatSection from '@/domains/recommend/components/ChatSection';
24
import Bg from '@/shared/assets/images/recommend_bg.webp';
5+
import { useAuthStore } from '@/domains/shared/store/auth';
6+
import ChatPreview from '@/domains/recommend/components/ChatPreview';
37

48
function Page() {
9+
const { user } = useAuthStore();
10+
511
return (
612
<div
713
className="relative bg-repeat bg-auto w-full flex flex-col"
814
style={{ backgroundImage: `url(${Bg.src})` }}
915
>
1016
<h1 className="sr-only">취향추천하기</h1>
11-
<ChatSection />
17+
{user ? <ChatSection /> : <ChatPreview />}
1218
</div>
1319
);
1420
}

src/domains/login/components/LoginRedirectHandler.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import Spinner from '@/shared/components/spinner/Spinner';
44
import WelcomeModal from '@/domains/login/components/WelcomeModal';
5-
import { useLoginRedirect } from '../hook/useAuthHooks';
5+
import { useLoginRedirect } from '../hook/useLoginRedirect';
66

77
function LoginRedirectHandler() {
88
const { loading, welcomeModalOpen, handleCloseWelcomeModal, user } = useLoginRedirect();

src/domains/login/components/LogoutConfirm.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import ConfirmModal from '@/shared/components/modal-pop/ConfirmModal';
2-
import { useLogout } from '../hook/useAuthHooks';
2+
import { useLogout } from '../hook/useLogout';
33

44
interface Props {
55
open: boolean;

src/domains/login/hook/useAuthHooks.ts renamed to src/domains/login/hook/useLoginRedirect.ts

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,9 @@
11
import { useAuthStore } from '@/domains/shared/store/auth';
2-
import { useCallback } from 'react';
32
import { useEffect, useState } from 'react';
43
import { usePathname, useRouter } from 'next/navigation';
54
import { getCookie, removeCookie } from '@/domains/shared/auth/utils/cookie';
65
import { useToast } from '@/shared/hook/useToast';
76

8-
export const useLogout = () => {
9-
const logout = useAuthStore((state) => state.logout);
10-
const { toastSuccess, toastError } = useToast();
11-
12-
const handleLogout = useCallback(async () => {
13-
try {
14-
await logout();
15-
toastSuccess('로그아웃 되었습니다.');
16-
} catch (err) {
17-
console.error('로그아웃 실패', err);
18-
toastError('로그아웃 실패 ❌ 다시 시도해주세요.');
19-
}
20-
}, [logout, toastSuccess, toastError]);
21-
22-
return handleLogout;
23-
};
24-
257
export const useLoginRedirect = () => {
268
const router = useRouter();
279
const pathname = usePathname();
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { useAuthStore } from '@/domains/shared/store/auth';
2+
import { useToast } from '@/shared/hook/useToast';
3+
import { useCallback } from 'react';
4+
import { useRouter } from 'next/navigation';
5+
6+
export const useLogout = () => {
7+
const logout = useAuthStore((state) => state.logout);
8+
const { toastSuccess, toastError } = useToast();
9+
const router = useRouter();
10+
11+
const handleLogout = useCallback(async () => {
12+
try {
13+
await logout();
14+
toastSuccess('로그아웃 되었습니다.');
15+
16+
// 마이페이지 일 시 메인페이지로 이동
17+
if (window.location.pathname.startsWith('/mypage')) {
18+
router.push('/');
19+
}
20+
} catch (err) {
21+
console.error('로그아웃 실패', err);
22+
toastError('로그아웃 실패 ❌ 다시 시도해주세요.');
23+
}
24+
}, [logout, toastSuccess, toastError, router]);
25+
26+
return handleLogout;
27+
};

0 commit comments

Comments
 (0)