add line | add circle | zoom | selectable geometry | geometry define entities type
This commit is contained in:
@@ -31,6 +31,21 @@ export async function fetchEntities(query?: { q?: string }): Promise<Entity[]> {
|
||||
return requestJson<Entity[]>(url);
|
||||
}
|
||||
|
||||
export async function searchEntitiesByName(
|
||||
name: string,
|
||||
options?: { limit?: number }
|
||||
): Promise<Entity[]> {
|
||||
const keyword = name.trim();
|
||||
if (!keyword.length) return [];
|
||||
|
||||
const params = new URLSearchParams({ name: keyword });
|
||||
if (options?.limit && Number.isFinite(options.limit)) {
|
||||
params.set("limit", String(Math.trunc(options.limit)));
|
||||
}
|
||||
|
||||
return requestJson<Entity[]>(`${API_ENDPOINTS.entities}/search?${params.toString()}`);
|
||||
}
|
||||
|
||||
export async function createEntity(payload: CreateEntityPayload): Promise<Entity> {
|
||||
return requestJson<Entity>(API_ENDPOINTS.entities, {
|
||||
method: "POST",
|
||||
|
||||
Reference in New Issue
Block a user