Replaced localhost url with actual web url
This commit is contained in:
@@ -10,4 +10,5 @@ export default defineConfig({
|
||||
adapter: nodeJs({
|
||||
mode: 'standalone'
|
||||
}),
|
||||
site: 'https://maps.alexcreates.fr'
|
||||
});
|
||||
@@ -1,6 +1,16 @@
|
||||
import { deepMap, onMount, task } from 'nanostores'
|
||||
import type { MapMarker, PlayerMarker } from '../../types/Leaflet';
|
||||
|
||||
let baseUrl: string
|
||||
|
||||
const isDev = import.meta.env.DEV;
|
||||
|
||||
if (isDev) {
|
||||
baseUrl = "http://localhost:4321/"
|
||||
} else {
|
||||
baseUrl = import.meta.env.SITE
|
||||
}
|
||||
|
||||
export const $world = deepMap({
|
||||
markers: [] as MapMarker[],
|
||||
players: {} as PlayerMarker,
|
||||
@@ -12,7 +22,7 @@ onMount($world, () => {
|
||||
task(async () => {
|
||||
let m
|
||||
try {
|
||||
m = await fetch('http://localhost:4321/api/markers.json')
|
||||
m = await fetch(`${baseUrl}/api/markers.json`)
|
||||
|
||||
$world.setKey('markers', await m.json())
|
||||
} catch (err) {
|
||||
@@ -23,7 +33,7 @@ onMount($world, () => {
|
||||
task(async () => {
|
||||
let p
|
||||
try {
|
||||
p = await fetch('http://localhost:4321/api/players.json')
|
||||
p = await fetch(`${baseUrl}/api/players.json`)
|
||||
|
||||
$world.setKey('players', await p.json())
|
||||
} catch (err) {
|
||||
|
||||
Reference in New Issue
Block a user