fixes
This commit is contained in:
parent
34430d9e99
commit
c3093f1030
@ -1,13 +1,31 @@
|
|||||||
import "./style.css";
|
import "./style.css";
|
||||||
|
import L from "leaflet";
|
||||||
import { initMap } from "./map.ts";
|
import { initMap } from "./map.ts";
|
||||||
import { checkAuth, renderAuthBar, setOnAuthChange } from "./auth.ts";
|
import { checkAuth, renderAuthBar, setOnAuthChange } from "./auth.ts";
|
||||||
import { loadPins, setupMapClick } from "./pins.ts";
|
import { loadPins, setupMapClick } from "./pins.ts";
|
||||||
|
|
||||||
async function main(): Promise<void> {
|
async function main(): Promise<void> {
|
||||||
initMap();
|
initMap();
|
||||||
await checkAuth();
|
|
||||||
|
// Prevent map from receiving clicks/scrolls through the auth bar
|
||||||
|
const authBar = document.getElementById("auth-bar")!;
|
||||||
|
L.DomEvent.disableClickPropagation(authBar);
|
||||||
|
L.DomEvent.disableScrollPropagation(authBar);
|
||||||
|
|
||||||
|
try {
|
||||||
|
await checkAuth();
|
||||||
|
} catch {
|
||||||
|
// Server may not be reachable; continue as logged out
|
||||||
|
}
|
||||||
|
|
||||||
renderAuthBar();
|
renderAuthBar();
|
||||||
await loadPins();
|
|
||||||
|
try {
|
||||||
|
await loadPins();
|
||||||
|
} catch {
|
||||||
|
// No pins to load if server is unreachable
|
||||||
|
}
|
||||||
|
|
||||||
setupMapClick();
|
setupMapClick();
|
||||||
|
|
||||||
setOnAuthChange(async () => {
|
setOnAuthChange(async () => {
|
||||||
|
|||||||
@ -19,7 +19,7 @@ body {
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
top: 10px;
|
top: 10px;
|
||||||
right: 10px;
|
right: 10px;
|
||||||
z-index: 1000;
|
z-index: 1001;
|
||||||
background: white;
|
background: white;
|
||||||
padding: 10px 14px;
|
padding: 10px 14px;
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
|
|||||||
@ -35,7 +35,7 @@ app.use("/api/pins", pinRoutes);
|
|||||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||||
const clientDist = path.join(__dirname, "../../client/dist");
|
const clientDist = path.join(__dirname, "../../client/dist");
|
||||||
app.use(express.static(clientDist));
|
app.use(express.static(clientDist));
|
||||||
app.get("*", (_req, res) => {
|
app.get("*path", (_req, res) => {
|
||||||
res.sendFile(path.join(clientDist, "index.html"));
|
res.sendFile(path.join(clientDist, "index.html"));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user