-
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.
* feat: 마이페이지, 로그아웃 구현 * chore: github-logo svg 이름 변경 * feat: 리뷰 반영 * feat: member api 추가
- Loading branch information
Showing
18 changed files
with
232 additions
and
8 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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { fetcher } from "@wow-class/utils"; | ||
import { apiPath } from "constants/apiPath"; | ||
|
||
export const authApi = { | ||
logout: async () => { | ||
const response = await fetcher.get(apiPath.logout); | ||
|
||
return { success: response.ok }; | ||
}, | ||
}; |
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,18 @@ | ||
import { fetcher } from "@wow-class/utils"; | ||
import { apiPath } from "constants/apiPath"; | ||
import { tags } from "constants/tags"; | ||
import type { MyAccountInfoDto } from "types/dtos/members"; | ||
|
||
export const membersApi = { | ||
getMyAccountInfo: async () => { | ||
const response = await fetcher.get<MyAccountInfoDto>( | ||
`${apiPath.members}/me/account-info`, | ||
{ | ||
next: { tags: [tags.myAccountInfo] }, | ||
cache: "force-cache", | ||
} | ||
); | ||
|
||
return response.data; | ||
}, | ||
}; |
65 changes: 65 additions & 0 deletions
65
apps/client/app/(afterLogin)/my-page/@modal/(.)logout/page.tsx
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,65 @@ | ||
"use client"; | ||
|
||
import { css } from "@styled-system/css"; | ||
import { Flex } from "@styled-system/jsx"; | ||
import { Modal, Space, Text } from "@wow-class/ui"; | ||
import { useModalRoute } from "@wow-class/ui/hooks"; | ||
import { authApi } from "apis/authApi"; | ||
import { routePath } from "constants/routePath"; | ||
import { useRouter } from "next/navigation"; | ||
import Button from "wowds-ui/Button"; | ||
|
||
const LogoutModal = () => { | ||
const router = useRouter(); | ||
const { closeModal } = useModalRoute(); | ||
const handleClickLogoutButton = async () => { | ||
const response = await authApi.logout(); | ||
if (response.success) { | ||
router.push(routePath["landing"]); | ||
} else { | ||
router.back(); | ||
} | ||
}; | ||
|
||
return ( | ||
<Modal> | ||
<Flex alignItems="center" className={containerStyle} direction="column"> | ||
<Text typo="h1"> | ||
<span className={headingStyle}>로그아웃</span> 하시겠어요? | ||
</Text> | ||
<Space height={26} /> | ||
<Flex gap="xs"> | ||
<Button | ||
size="lg" | ||
style={buttonStyle} | ||
variant="outline" | ||
onClick={closeModal} | ||
> | ||
취소 | ||
</Button> | ||
<Button | ||
size="lg" | ||
style={buttonStyle} | ||
onClick={handleClickLogoutButton} | ||
> | ||
로그아웃 | ||
</Button> | ||
</Flex> | ||
</Flex> | ||
</Modal> | ||
); | ||
}; | ||
|
||
export default LogoutModal; | ||
|
||
const headingStyle = css({ | ||
color: "primary", | ||
}); | ||
|
||
const containerStyle = css({ | ||
width: "652px", | ||
}); | ||
|
||
const buttonStyle = { | ||
width: "173px", | ||
}; |
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,5 @@ | ||
const Default = () => { | ||
return null; | ||
}; | ||
|
||
export default Default; |
64 changes: 64 additions & 0 deletions
64
apps/client/app/(afterLogin)/my-page/_components/MyInfoBox.tsx
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,64 @@ | ||
import { Flex } from "@styled-system/jsx"; | ||
import { Space, Text } from "@wow-class/ui"; | ||
import { membersApi } from "apis/membersApi"; | ||
import { routePath } from "constants/routePath"; | ||
import Image from "next/image"; | ||
import Link from "next/link"; | ||
import Box from "wowds-ui/Box"; | ||
import Button from "wowds-ui/Button"; | ||
import TextButton from "wowds-ui/TextButton"; | ||
|
||
export const MyInfoBox = async () => { | ||
const myInfo = await membersApi.getMyAccountInfo(); | ||
|
||
if (!myInfo) return; | ||
const { name, githubHandle } = myInfo; | ||
|
||
return ( | ||
<> | ||
<Box | ||
style={{ width: "424px" }} | ||
text={ | ||
<> | ||
<Text color="primary">계정 정보</Text> | ||
<Space height={12} /> | ||
<Flex alignItems="end" gap="xs"> | ||
<Text typo="h1">{name} 님</Text> | ||
<Text typo="body2">@{githubHandle}</Text> | ||
</Flex> | ||
<Space height={58} /> | ||
<Flex gap="xs"> | ||
<Link href={routePath["onboarding"]} target="_blank"> | ||
<Button size="sm" variant="outline"> | ||
계정 정보 | ||
</Button> | ||
</Link> | ||
<Link | ||
href={`${routePath["github"]}/${githubHandle}`} | ||
target="_blank" | ||
> | ||
<Button | ||
size="sm" | ||
variant="outline" | ||
icon={ | ||
<Image | ||
alt="github-logo" | ||
height={14} | ||
src="/images/github-logo-black.svg" | ||
width={14} | ||
/> | ||
} | ||
> | ||
나의 Github | ||
</Button> | ||
</Link> | ||
<Link href={routePath["my-page-logout"]}> | ||
<TextButton text="로그아웃" /> | ||
</Link> | ||
</Flex> | ||
</> | ||
} | ||
/> | ||
</> | ||
); | ||
}; |
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,5 @@ | ||
const Default = () => { | ||
return null; | ||
}; | ||
|
||
export default Default; |
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,16 @@ | ||
const Layout = ({ | ||
children, | ||
modal, | ||
}: { | ||
children: React.ReactNode; | ||
modal: React.ReactNode; | ||
}) => { | ||
return ( | ||
<main> | ||
{children} | ||
{modal} | ||
</main> | ||
); | ||
}; | ||
|
||
export default Layout; |
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,8 @@ | ||
import { routePath } from "constants/routePath"; | ||
import { redirect } from "next/navigation"; | ||
|
||
const LogoutPage = () => { | ||
return redirect(routePath["my-page"]); | ||
}; | ||
|
||
export default LogoutPage; |
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,5 +1,15 @@ | ||
import { Space, Text } from "@wow-class/ui"; | ||
|
||
import { MyInfoBox } from "./_components/MyInfoBox"; | ||
|
||
const MyPage = () => { | ||
return <div>MyPage</div>; | ||
return ( | ||
<> | ||
<Text typo="h1">마이 페이지</Text> | ||
<Space height={16} /> | ||
<MyInfoBox /> | ||
</> | ||
); | ||
}; | ||
|
||
export default MyPage; |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
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,3 @@ | ||
import type { MyInfoType } from "types/entities/common/auth"; | ||
|
||
export interface MyAccountInfoDto extends MyInfoType {} |
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 +1,5 @@ | ||
export type StatusType = "UNSATISFIED" | "IN_PROGRESS" | "SATISFIED"; | ||
export interface MyInfoType { | ||
name: string; | ||
githubHandle: string; | ||
} |