-
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.
feat(location): lat, lng 데이터 정규화 처리 유틸함수 구현 (#97)
- 현재 위/경도의 1,000,000이 곱한 데이터로 응답 - 위/경도 데이터 변환 유틸 함수 추가 - 차량 정보 API 응답 coordinate 정규화 로직 적용
- Loading branch information
1 parent
a8c8fb2
commit 6752f56
Showing
3 changed files
with
29 additions
and
9 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,15 @@ | ||
import { VehicleInfoModel } from '@/types/vehicle' | ||
|
||
export const normalizeCoordinate = (coordinateValue: number): number => coordinateValue / 1000000 | ||
export const denormalizeCoordinate = (coordinateValue: number): number => coordinateValue * 1000000 | ||
|
||
export const normalizeVehicleResponse = (data: VehicleInfoModel) => { | ||
return { | ||
...data, | ||
recentCycleInfo: { | ||
...data.recentCycleInfo, | ||
lat: normalizeCoordinate(data.recentCycleInfo.lat), | ||
lng: normalizeCoordinate(data.recentCycleInfo.lng), | ||
}, | ||
} | ||
} |