-
Notifications
You must be signed in to change notification settings - Fork 5
[FEAT] 워크스페이스 프로필 및 나의 프로필 API 세팅 #111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
d724d53
#101 [FEAT] 팀 순서 변경 API 세팅
jinj00oo 738a91d
Merge branch 'develop' of https://github.com/vecosystem/VECO_Frontend…
jinj00oo 3a41f7b
#101 [REFACTOR] 팀 타입 추출 및 API 호출 위치 주석 처리
jinj00oo b536875
#102 [FEAT] 워크스페이스 프로필 API 세팅
jinj00oo d080d2f
#102 [FEAT] 마이 프로필 API 세팅
jinj00oo 46ee228
#102 [MOD] API 호출 위치 및 함수 설명 주석 처리
jinj00oo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,27 @@ | ||
| import type { CommonResponse } from '../../types/common'; | ||
| import { axiosInstance } from '../axios'; | ||
| import { useMutation } from '@tanstack/react-query'; | ||
| import queryClient from '../../utils/queryClient'; | ||
| import { queryKey } from '../../constants/queryKey'; | ||
|
|
||
| // 설정 - 나의 프로필 이미지 삭제 | ||
| const deleteMyProfileImage = async (): Promise<CommonResponse<{}>> => { | ||
| try { | ||
| const response = await axiosInstance.delete('/api/workspace/setting/my-profile/profileImage'); | ||
| return response.data; | ||
| } catch (error) { | ||
| console.error('나의 프로필 이미지 삭제 실패', error); | ||
| throw error; | ||
| } | ||
| }; | ||
|
|
||
| export const useDeleteMyProfileImage = () => { | ||
| return useMutation({ | ||
| mutationFn: deleteMyProfileImage, | ||
| onSuccess: () => { | ||
| void queryClient.invalidateQueries({ | ||
| queryKey: [queryKey.MY_PROFILE], | ||
| }); | ||
| }, | ||
| }); | ||
| }; |
This file contains hidden or 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,22 @@ | ||
| import { axiosInstance } from '../axios'; | ||
| import type { MyProfile } from '../../types/setting'; | ||
| import { useQuery } from '@tanstack/react-query'; | ||
| import { queryKey } from '../../constants/queryKey'; | ||
|
|
||
| // 설정 - 나의 프로필 조회 | ||
| const getMyProfile = async (): Promise<MyProfile> => { | ||
| try { | ||
| const response = await axiosInstance.get('/api/workspace/setting/my-profile'); | ||
| return response.data.result; | ||
| } catch (error) { | ||
| console.error('나의 프로필 조회 실패', error); | ||
| throw error; | ||
| } | ||
| }; | ||
|
|
||
| export const useGetMyProfile = () => { | ||
| return useQuery({ | ||
| queryKey: [queryKey.MY_PROFILE], | ||
| queryFn: getMyProfile, | ||
| }); | ||
| }; |
This file contains hidden or 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,22 @@ | ||
| import type { Workspace } from '../../types/setting'; | ||
| import { axiosInstance } from '../axios'; | ||
| import { useQuery } from '@tanstack/react-query'; | ||
| import { queryKey } from '../../constants/queryKey'; | ||
|
|
||
| // 설정 - 워크스페이스 프로필 조회 | ||
| const getWorkspaceProfile = async (): Promise<Workspace> => { | ||
| try { | ||
| const response = await axiosInstance.get('/api/workspace/setting/profile'); | ||
| return response.data.result; | ||
| } catch (error) { | ||
| console.error('워크스페이스 프로필 조회 실패', error); | ||
| throw error; | ||
| } | ||
| }; | ||
|
|
||
| export const useGetWorkspaceProfile = () => { | ||
| return useQuery({ | ||
| queryKey: [queryKey.WORKSPACE_PROFILE], | ||
| queryFn: getWorkspaceProfile, | ||
| }); | ||
| }; |
This file contains hidden or 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,35 @@ | ||
| import { axiosInstance } from '../axios'; | ||
| import type { MyProfileImage } from '../../types/setting'; | ||
| import { useMutation } from '@tanstack/react-query'; | ||
| import queryClient from '../../utils/queryClient'; | ||
| import { queryKey } from '../../constants/queryKey'; | ||
|
|
||
| // 설정 - 나의 프로필 이미지 변경 | ||
| const patchMyProfileImage = async (formData: FormData): Promise<MyProfileImage> => { | ||
| try { | ||
| const response = await axiosInstance.patch( | ||
| '/api/workspace/setting/my-profile/profileImage', | ||
| formData, | ||
| { | ||
| headers: { | ||
| 'Content-Type': 'multipart/form-data', | ||
| }, | ||
| } | ||
| ); | ||
| return response.data.result; | ||
| } catch (error) { | ||
| console.error('나의 프로필 이미지 변경 실패', error); | ||
| throw error; | ||
| } | ||
| }; | ||
|
|
||
| export const usePatchMyProfileImage = () => { | ||
| return useMutation({ | ||
| mutationFn: patchMyProfileImage, | ||
| onSuccess: () => { | ||
| void queryClient.invalidateQueries({ | ||
| queryKey: [queryKey.MY_PROFILE], | ||
| }); | ||
| }, | ||
| }); | ||
| }; |
This file contains hidden or 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,27 @@ | ||
| import { axiosInstance } from '../axios'; | ||
| import { useMutation } from '@tanstack/react-query'; | ||
| import type { CommonResponse } from '../../types/common'; | ||
| import queryClient from '../../utils/queryClient'; | ||
| import { queryKey } from '../../constants/queryKey'; | ||
|
|
||
| // 사이드바, 설정 - 팀 순서 변경 | ||
| const patchWorkspaceTeams = async (body: { teamIdList: number[] }): Promise<CommonResponse<{}>> => { | ||
| try { | ||
| const response = await axiosInstance.patch('/api/workspace/setting/teams', body); | ||
| return response.data; | ||
| } catch (error) { | ||
| console.error('워크스페이스 팀 순서 변경 실패', error); | ||
| throw error; | ||
| } | ||
| }; | ||
|
|
||
| export const usePatchWorkspaceTeams = () => { | ||
| return useMutation({ | ||
| mutationFn: patchWorkspaceTeams, | ||
| onSuccess: () => { | ||
| void queryClient.invalidateQueries({ | ||
| queryKey: [queryKey.WORKSPACE_TEAMS], | ||
| }); | ||
| }, | ||
| }); | ||
| }; | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 { TeamListResponse } from '../../types/setting'; | ||
|
|
||
| export type Team = Pick<TeamListResponse, 'teamId' | 'name' | 'profileUrl'>; |
This file contains hidden or 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,7 @@ | ||
| export const queryKey = { | ||
| WORKSPACE_PROFILE: 'workspace_profile', | ||
| WORKSPACE_TEAMS: 'workspace_teams', | ||
| WORKSPACE_MEMBERS: 'workspace_members', | ||
| MY_PROFILE: 'my_profile', | ||
| GITHUB_LINK: 'github_link', | ||
| }; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
p2 : 진주님
apis/setting폴더 속 함수들 위에 이 부분처럼 주석 달아주셔야 합니다! 다른 파일들도 수정해서 푸쉬해주세요!There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
추가하여 푸쉬하였습니다. 알려주셔서 감사합니다!