map-tile.ts 501 B

123456789101112131415161718192021222324
  1. import axios from "./instance";
  2. import { MAP_TILE_LIST } from "./constant";
  3. type ServiceMapTile = {
  4. id: number;
  5. name: string,
  6. mapUrl: string;
  7. coord: string;
  8. };
  9. export type MapTile = {
  10. id: number;
  11. name: string,
  12. mapUrls: {tempUrl: string, maximumLevel: number}[];
  13. coord: string;
  14. };
  15. export const fetchMapTiles = async () => {
  16. const items = await axios.get<ServiceMapTile[]>(MAP_TILE_LIST);
  17. return items.map((item) => ({
  18. ...item,
  19. mapUrls: JSON.parse(item.mapUrl),
  20. }));
  21. };