Refactor map tools and drop SocialParser runtime dependency.
Add filtered map API, creamy-caprice-style toolbar (dates, layers, search), Yandex ru tiles, and store Telegram session in MapMil/data instead of mounting SocialParser. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import { request } from "./client";
|
||||
import type { MapFilters, MapObjectWithEvent, MapQueryParams } from "../types/map";
|
||||
|
||||
function buildQuery(params: MapQueryParams): string {
|
||||
const search = new URLSearchParams();
|
||||
for (const [key, value] of Object.entries(params)) {
|
||||
if (value !== undefined && value !== "") {
|
||||
search.set(key, String(value));
|
||||
}
|
||||
}
|
||||
const qs = search.toString();
|
||||
return qs ? `?${qs}` : "";
|
||||
}
|
||||
|
||||
export function fetchMapObjects(params: MapQueryParams = {}): Promise<MapObjectWithEvent[]> {
|
||||
return request<MapObjectWithEvent[]>(`/map/objects${buildQuery(params)}`);
|
||||
}
|
||||
|
||||
export function fetchMapFilters(): Promise<MapFilters> {
|
||||
return request<MapFilters>("/map/filters");
|
||||
}
|
||||
Reference in New Issue
Block a user