-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #137 from alkong-dalkong/feature/#111_setting_page
feat: 설정 페이지 UI 및 기능 추가
- Loading branch information
Showing
40 changed files
with
871 additions
and
51 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
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,7 @@ | ||
import { SettingCleintPage } from '@/features' | ||
|
||
const Setting = () => { | ||
return <SettingCleintPage /> | ||
} | ||
|
||
export default Setting |
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
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,19 @@ | ||
import type { IconProps } from '.' | ||
|
||
export const NextBtn = (props: IconProps) => { | ||
const { color = '#13A076', size = 39 } = props | ||
|
||
return ( | ||
<svg | ||
xmlns="http://www.w3.org/2000/svg" | ||
width={size} | ||
height={size} | ||
viewBox="0 0 39 39" | ||
fill="none" | ||
> | ||
<rect width={size} height={size} rx="19.5" fill={color} /> | ||
<rect width={size} height={size} rx="11" fill={color} /> | ||
<path d="M30 19.5L14.25 28.5933L14.25 10.4067L30 19.5Z" fill="white" /> | ||
</svg> | ||
) | ||
} |
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,6 @@ | ||
export const settingQueryKeys = { | ||
all: ['setting'] as const, | ||
userInfo: () => [...settingQueryKeys.all, 'userInfo'] as const, | ||
members: (familyCode: string) => [...settingQueryKeys.all, 'members', familyCode] as const, | ||
groups: () => [...settingQueryKeys.all, 'groups'] as const, | ||
} |
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 @@ | ||
import { api } from '@/apis' | ||
import type { ReadFamilyGroupsResponse, ReadFamilyMembersResponse } from '@/types' | ||
import { | ||
type CreateFamilyGroupResponse, | ||
type EditPasswordRequest, | ||
type EditUserInfoRequest, | ||
type EnterFamilyGroupRequest, | ||
type ReadUserInfoResponse, | ||
} from '@/types' | ||
|
||
export const editUserInfo = async (request: EditUserInfoRequest) => { | ||
return await api.put('/mypage/edit-info', request) | ||
} | ||
|
||
export const readUserInfo = async () => { | ||
return await api.get<ReadUserInfoResponse>('/mypage/edit-info') | ||
} | ||
|
||
export const editPassword = async (request: EditPasswordRequest) => { | ||
return await api.post('/mypage/edit-password', request) | ||
} | ||
|
||
export const createFamilyGroup = async () => { | ||
return await api.post<CreateFamilyGroupResponse>('/mypage/create-family') | ||
} | ||
|
||
export const enterFamilyGroup = async (request: EnterFamilyGroupRequest) => { | ||
return await api.post('/mypage/enter-family', request) | ||
} | ||
|
||
export const readFamilyMembers = async (familyCode: string) => { | ||
return await api.get<ReadFamilyMembersResponse>(`/member-info/${familyCode}`) | ||
} | ||
|
||
export const readFamilyGroups = async () => { | ||
return await api.get<ReadFamilyGroupsResponse>('/mypage/family-list') | ||
} |
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 @@ | ||
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query' | ||
|
||
import { | ||
createFamilyGroup, | ||
editPassword, | ||
editUserInfo, | ||
enterFamilyGroup, | ||
readFamilyGroups, | ||
readFamilyMembers, | ||
readUserInfo, | ||
settingQueryKeys, | ||
} from '@/features' | ||
|
||
export const useEditUserInfo = () => { | ||
const queryClient = useQueryClient() | ||
|
||
return useMutation({ | ||
mutationFn: editUserInfo, | ||
onSuccess: () => { | ||
queryClient.invalidateQueries({ queryKey: settingQueryKeys.userInfo() }) | ||
}, | ||
}) | ||
} | ||
|
||
export const useReadUserInfo = () => | ||
useQuery({ | ||
queryKey: settingQueryKeys.userInfo(), | ||
queryFn: readUserInfo, | ||
}) | ||
|
||
export const useEditPassword = () => { | ||
return useMutation({ | ||
mutationFn: editPassword, | ||
}) | ||
} | ||
|
||
export const useCreateFamilyGroup = () => { | ||
return useMutation({ | ||
mutationFn: createFamilyGroup, | ||
}) | ||
} | ||
|
||
export const useEnterFamilyGroup = (familyCode: string) => { | ||
const queryClient = useQueryClient() | ||
|
||
return useMutation({ | ||
mutationFn: enterFamilyGroup, | ||
onSuccess: () => { | ||
queryClient.invalidateQueries({ queryKey: settingQueryKeys.members(familyCode) }) | ||
}, | ||
}) | ||
} | ||
|
||
export const useReadFamilyMembers = (familyCode: string) => | ||
useQuery({ | ||
queryKey: settingQueryKeys.members(familyCode), | ||
queryFn: () => readFamilyMembers(familyCode), | ||
enabled: !!familyCode, | ||
}) | ||
|
||
export const useReadFamilyGroups = () => | ||
useQuery({ | ||
queryKey: settingQueryKeys.groups(), | ||
queryFn: readFamilyGroups, | ||
}) |
Oops, something went wrong.