|
@ -116,8 +116,6 @@ function buildPolygonsObject(response, name) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function buildMarkerObject(response, name) { |
|
|
function buildMarkerObject(response, name) { |
|
|
console.log("\n\n--------------------------------------------------------"); |
|
|
|
|
|
//console.log(response);
|
|
|
|
|
|
const r = JSON.parse(response); |
|
|
const r = JSON.parse(response); |
|
|
|
|
|
|
|
|
const resposta = r.formsanswersgeom; |
|
|
const resposta = r.formsanswersgeom; |
|
@ -127,7 +125,6 @@ function buildMarkerObject(response, name) { |
|
|
if (r.array_to_json) { |
|
|
if (r.array_to_json) { |
|
|
situation = r.array_to_json.find((field) => field.fieldname == "situation"); |
|
|
situation = r.array_to_json.find((field) => field.fieldname == "situation"); |
|
|
} |
|
|
} |
|
|
// console.log(situation.fieldsanswersvalue);
|
|
|
|
|
|
|
|
|
|
|
|
return { |
|
|
return { |
|
|
ID: r.formsanswersid, |
|
|
ID: r.formsanswersid, |
|
@ -144,13 +141,10 @@ function buildMarkerObject(response, name) { |
|
|
|
|
|
|
|
|
function verifyResponse(response, name) { |
|
|
function verifyResponse(response, name) { |
|
|
var markers = []; |
|
|
var markers = []; |
|
|
var cache_marker = []; |
|
|
|
|
|
|
|
|
|
|
|
if (response) { |
|
|
if (response) { |
|
|
const answer = JSON.parse(response); |
|
|
const answer = JSON.parse(response); |
|
|
if (answer.success == true) { |
|
|
if (answer.success == true) { |
|
|
const formAnswer = answer.responseData.array_to_json; |
|
|
|
|
|
|
|
|
|
|
|
answer.responseData.array_to_json.forEach((r) => { |
|
|
answer.responseData.array_to_json.forEach((r) => { |
|
|
if (r.formcode == "FLOODZONES_OFFICIAL") { |
|
|
if (r.formcode == "FLOODZONES_OFFICIAL") { |
|
|
markers.push(buildPolygonsObject(JSON.stringify(r), name)); |
|
|
markers.push(buildPolygonsObject(JSON.stringify(r), name)); |
|
@ -256,7 +250,7 @@ export default function useSocketMarkers(fetchFromCache) { |
|
|
if (fetchFromCache) { |
|
|
if (fetchFromCache) { |
|
|
formsKeys.forEach((key) => { |
|
|
formsKeys.forEach((key) => { |
|
|
cache.get(key).then((cachedData) => { |
|
|
cache.get(key).then((cachedData) => { |
|
|
if (cachedData) { |
|
|
|
|
|
|
|
|
if (cachedData && cachedData?.success) { |
|
|
dispatch({ increment: JSON.parse(cachedData) }); |
|
|
dispatch({ increment: JSON.parse(cachedData) }); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
@ -266,7 +260,6 @@ export default function useSocketMarkers(fetchFromCache) { |
|
|
global.formsSockets.forEach((socket) => |
|
|
global.formsSockets.forEach((socket) => |
|
|
getFormsAnswers(socket, dispatch, fetchFromCache) |
|
|
getFormsAnswers(socket, dispatch, fetchFromCache) |
|
|
); |
|
|
); |
|
|
//console.log(state.markers)
|
|
|
|
|
|
|
|
|
|
|
|
return state; |
|
|
return state; |
|
|
} |
|
|
} |