|
|
@@ -32,8 +32,9 @@ export const useFenceStore = defineStore('fencePolygonStore', () => {
|
|
|
if (!param.algoId || !param.cameraId || !param.presetToken) return;
|
|
|
return getFenceApi(param)
|
|
|
.then((res) => {
|
|
|
- const fence = res.electronicFencePolygon
|
|
|
- ? (JSON.parse(res.electronicFencePolygon) as [])
|
|
|
+ currentFenceGroupId.value = res?.id;
|
|
|
+ const fence = res?.electronicFencePolygon
|
|
|
+ ? (JSON.parse(res?.electronicFencePolygon) as [])
|
|
|
: ([] as { polygon: string }[]);
|
|
|
// const pointsJSON = points.poly
|
|
|
const newFence = fence.map((x) => {
|
|
|
@@ -41,7 +42,6 @@ export const useFenceStore = defineStore('fencePolygonStore', () => {
|
|
|
}) as unknown as ServerLineInfos;
|
|
|
allFences.value = newFence;
|
|
|
initialFence.value = newFence;
|
|
|
- currentFenceGroupId.value = res.id;
|
|
|
})
|
|
|
.catch(() => {
|
|
|
currentFenceId.value = null;
|
|
|
@@ -49,6 +49,7 @@ export const useFenceStore = defineStore('fencePolygonStore', () => {
|
|
|
})
|
|
|
.finally(() => {
|
|
|
loading.value = false;
|
|
|
+ currentFenceId.value = null;
|
|
|
});
|
|
|
};
|
|
|
|