Added current player marker
This commit is contained in:
9
src/pages/api/data/players.markers.ts
Normal file
9
src/pages/api/data/players.markers.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import type { PlayerMarker } from "@/types/Leaflet";
|
||||
|
||||
export const playerPosition: PlayerMarker = {
|
||||
markerCoords: {
|
||||
y: -57.83673,
|
||||
x: 162.05197
|
||||
},
|
||||
title: "L'Éclipse",
|
||||
}
|
||||
8
src/pages/api/players.json.ts
Normal file
8
src/pages/api/players.json.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import type { APIRoute } from "astro";
|
||||
import { playerPosition } from "./data/players.markers";
|
||||
|
||||
export const GET: APIRoute = ({ params, request }) => {
|
||||
return new Response(
|
||||
JSON.stringify(playerPosition)
|
||||
)
|
||||
}
|
||||
@@ -2,10 +2,12 @@
|
||||
import Layout from '../layouts/Layout.astro';
|
||||
import AllianceKaldelienne from '../components/maps/AllianceKaldelienne.astro'
|
||||
|
||||
const res = await fetch('http://localhost:4321/api/markers.json');
|
||||
const data = await res.json();
|
||||
const fetchLandMarkers = await fetch('http://localhost:4321/api/markers.json');
|
||||
const fetchPlayersPosition = await fetch('http://localhost:4321/api/players.json');
|
||||
const landData = await fetchLandMarkers.json();
|
||||
const playerCoords = await fetchPlayersPosition.json();
|
||||
---
|
||||
|
||||
<Layout title="Leim Wiki - Cartographie">
|
||||
<AllianceKaldelienne markers={data} />
|
||||
<AllianceKaldelienne markers={landData} players={playerCoords} />
|
||||
</Layout>
|
||||
|
||||
Reference in New Issue
Block a user