Feat: 이메일 검색 등 함수 및 쿼리 추가
This commit is contained in:
parent
ea344dca19
commit
c9ff589f57
11
frontend/src/api/memberApi.ts
Normal file
11
frontend/src/api/memberApi.ts
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
import api from '@/api/axiosConfig';
|
||||||
|
import { MemberSearchResponse } from '@/types';
|
||||||
|
|
||||||
|
export async function searchMembersByEmail(keyword: string) {
|
||||||
|
return api
|
||||||
|
.get<MemberSearchResponse[]>(`/api/members`, {
|
||||||
|
params: { keyword },
|
||||||
|
withCredentials: true,
|
||||||
|
})
|
||||||
|
.then(({ data }) => data);
|
||||||
|
}
|
@ -1,5 +1,11 @@
|
|||||||
import api from '@/api/axiosConfig';
|
import api from '@/api/axiosConfig';
|
||||||
import { WorkspaceListResponse, WorkspaceRequest, WorkspaceResponse, ReviewResponse } from '@/types';
|
import {
|
||||||
|
WorkspaceListResponse,
|
||||||
|
WorkspaceRequest,
|
||||||
|
WorkspaceResponse,
|
||||||
|
ReviewResponse,
|
||||||
|
WorkspaceMemberResponse,
|
||||||
|
} from '@/types';
|
||||||
|
|
||||||
export async function getWorkspaceList(memberId: number, lastWorkspaceId?: number, limit?: number) {
|
export async function getWorkspaceList(memberId: number, lastWorkspaceId?: number, limit?: number) {
|
||||||
return api
|
return api
|
||||||
@ -67,3 +73,14 @@ export async function getWorkspaceReviews(
|
|||||||
})
|
})
|
||||||
.then(({ data }) => data);
|
.then(({ data }) => data);
|
||||||
}
|
}
|
||||||
|
export async function removeWorkspaceMember(workspaceId: number, memberId: number, targetMemberId: number) {
|
||||||
|
return api
|
||||||
|
.delete(`/workspaces/${workspaceId}/members/${targetMemberId}`, {
|
||||||
|
params: { memberId },
|
||||||
|
})
|
||||||
|
.then(({ data }) => data);
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function getWorkspaceMembers(workspaceId: number) {
|
||||||
|
return api.get<WorkspaceMemberResponse[]>(`/workspaces/${workspaceId}/members`).then(({ data }) => data);
|
||||||
|
}
|
||||||
|
@ -0,0 +1,9 @@
|
|||||||
|
import { searchMembersByEmail } from '@/api/memberApi';
|
||||||
|
import { useSuspenseQuery } from '@tanstack/react-query';
|
||||||
|
|
||||||
|
export default function useSearchMembersByEmailQuery(keyword: string) {
|
||||||
|
return useSuspenseQuery({
|
||||||
|
queryKey: ['members', keyword],
|
||||||
|
queryFn: () => searchMembersByEmail(keyword),
|
||||||
|
});
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
import { getWorkspaceMembers } from '@/api/workspaceApi';
|
||||||
|
import { useSuspenseQuery } from '@tanstack/react-query';
|
||||||
|
|
||||||
|
export default function useWorkspaceMembersQuery(workspaceId: number) {
|
||||||
|
return useSuspenseQuery({
|
||||||
|
queryKey: ['workspaceMembers', workspaceId],
|
||||||
|
queryFn: () => getWorkspaceMembers(workspaceId),
|
||||||
|
});
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user