Skip to content

Commit

Permalink
refactor: 맵 상세 페이지를 새로운 API 명세에 맞게 마이그레이션 (#980)
Browse files Browse the repository at this point in the history
* refactor: axios api v2 작성

* refactor: api request 및 query v2 작성

* refactor: useManagerMap 사용처 v2 마이그레이션

* refactor: 불필요한 Vertical Bar 제거

* refactor: MapItemResponse type에 slackUrl 프로퍼티 추가

---------

Co-authored-by: 2yunseong <[email protected]>
  • Loading branch information
suyoungj and 2yunseong authored Nov 2, 2023
1 parent 41f7d4c commit a5f7d02
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
3 changes: 2 additions & 1 deletion frontend/src/hooks/query-v2/useManagerMapV2.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { AxiosError, AxiosResponse } from 'axios';
import { QueryKey, useQuery, UseQueryOptions, UseQueryResult } from 'react-query';
import { QueryManagerMapParamsV2, queryManagerMapV2 } from 'api-v2/managerMap';
import { QueryManagerMapParams } from 'api/managerMap';
import { ErrorResponse } from 'types/response';
import { QueryManagerMapSuccessV2 } from 'types/response-v2';

Expand All @@ -13,6 +14,6 @@ const useManagerMapV2 = <TData = AxiosResponse<QueryManagerMapSuccessV2>>(
[QueryKey, QueryManagerMapParamsV2]
>
): UseQueryResult<TData, AxiosError<ErrorResponse>> =>
useQuery(['getManagerMapV2', { mapId }], queryManagerMapV2, { ...options });
useQuery(['getManagerMapV2', { mapId }], queryManagerMapV2, options);

export default useManagerMapV2;
9 changes: 2 additions & 7 deletions frontend/src/pages/ManagerMapDetail/ManagerMapDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,11 @@ import DateInput from 'components/DateInput/DateInput';
import Header from 'components/Header/Header';
import IconButton from 'components/IconButton/IconButton';
import Layout from 'components/Layout/Layout';
import MapNoticeButton from 'components/ManagerIconButtons/MapNoticeButton';
import ShareLinkButton from 'components/ManagerIconButtons/ShareLinkButton';
import SlackNotiButton from 'components/ManagerIconButtons/SlackNotiButton';
import PageHeader from 'components/PageHeader/PageHeader';
import MESSAGE from 'constants/message';
import PATH, { HREF } from 'constants/path';
import useManagerMap from 'hooks/query/useManagerMap';
import useManagerMapV2 from 'hooks/query-v2/useManagerMapV2';
import useManagerMapReservations from 'hooks/query/useManagerMapReservations';
import useManagerSpaces from 'hooks/query/useManagerSpaces';
import { Reservation } from 'types/common';
Expand All @@ -41,7 +39,7 @@ const ManagerMapDetail = (): JSX.Element => {

const [date, setDate] = useState(targetDate ?? dayjs().tz());

const getMap = useManagerMap(
const getMap = useManagerMapV2(
{ mapId: mapId },
{
enabled: !isNullish(mapId),
Expand Down Expand Up @@ -158,7 +156,6 @@ const ManagerMapDetail = (): JSX.Element => {
rightButtons={
getMap.data?.data != null && (
<>
<MapNoticeButton text="공지사항" size="small" map={getMap.data.data} />
<SlackNotiButton text="알림 설정" size="small" map={getMap.data.data} />
<Styled.VerticalBar />
<IconButton text="맵 편집" size="small" onClick={handleClickMapEditorIcon}>
Expand All @@ -167,8 +164,6 @@ const ManagerMapDetail = (): JSX.Element => {
<IconButton text="공간 편집" size="small" onClick={handleClickSpaceEditorIcon}>
<SpaceEditorIcon width="100%" height="100%" />
</IconButton>
<Styled.VerticalBar />
<ShareLinkButton text="공유 링크" size="small" map={getMap.data.data} />
</>
)
}
Expand Down

0 comments on commit a5f7d02

Please sign in to comment.