-
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/feat&refactor: 지도 기본 정보 조회 api 연동 및 관련 분기 처리
- Loading branch information
Showing
24 changed files
with
321 additions
and
297 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { useQuery } from 'react-query'; | ||
import instance from '../instance'; | ||
import { BaseResponse } from '../../types/BaseResponse'; | ||
import { MapBasicInfo } from '../../types/map/MapBasicInfo'; | ||
import { MapMode } from '../../types/enum/MapMode'; | ||
|
||
export const fetchMapBasicInfo = async (id: number) => { | ||
const response = await instance.get<BaseResponse<MapBasicInfo>>( | ||
`/map/${id}/basic-info/edit`, | ||
); | ||
return response.data; | ||
}; | ||
|
||
export const fetchMapBasicInfoForViewer = async (id: number) => { | ||
const response = await instance.get<BaseResponse<MapBasicInfo>>( | ||
`/map/${id}/basic-info/view`, | ||
); | ||
return response.data; | ||
}; | ||
|
||
export const useMapBasicInfoQuery = (id: number, mapMode: MapMode) => { | ||
const { data: mapBasicInfo, isLoading: isMapBasicInfoLoading } = useQuery({ | ||
queryKey: ['fetchMapBasicInfo'], | ||
|
||
queryFn: () => { | ||
if (mapMode === MapMode.EDIT) return fetchMapBasicInfo(id); | ||
if (mapMode === MapMode.VIEW) return fetchMapBasicInfoForViewer(id); | ||
}, | ||
}); | ||
|
||
return { mapBasicInfo, isMapBasicInfoLoading }; | ||
}; |
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
112 changes: 107 additions & 5 deletions
112
src/components/map/MapInfoPanel/MapBasicInfo/MapBasicInfoContainer/MapBasicInfoContainer.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
16 changes: 0 additions & 16 deletions
16
.../map/MapInfoPanel/MapBasicInfo/MapBasicInfoContainer/MapLocationInfoContainer.module.scss
This file was deleted.
Oops, something went wrong.
26 changes: 0 additions & 26 deletions
26
...mponents/map/MapInfoPanel/MapBasicInfo/MapBasicInfoContainer/MapLocationInfoContainer.tsx
This file was deleted.
Oops, something went wrong.
44 changes: 0 additions & 44 deletions
44
...Panel/MapBasicInfo/MapBasicInfoContainer/MapTitleAndDescriptionInputContainer.module.scss
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.