Skip to content

Commit 5476b62

Browse files
Merge pull request #132 from OCA-UFCG/fix/fix_first_faulty_post_req
Fix/fix first faulty post req
2 parents d981f6a + 54039e7 commit 5476b62

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

src/components/MapsSection/MapsSection.tsx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const MapsSection = ({
3737
const [isLoading, setLoading] = useState<boolean>(false);
3838
const [currentVisu, setCurrentVisu] = useState<IEEInfo>(defaultEEInfo);
3939
const [imageData, setImageData] = useState<IMapInfo>({
40-
name: "cisterna",
40+
name: "",
4141
year: "general",
4242
});
4343
const [pinMap, setPinMap] = useState<boolean>(false);
@@ -88,18 +88,20 @@ const MapsSection = ({
8888
}, [currentVisu, tiffInfo, pinMap]);
8989

9090
useEffect(() => {
91-
if (tiffInfo.length != 0) {
91+
if (tiffInfo.length !== 0) {
9292
setCurrentVisu(tiffInfo.map((map) => map.fields)[0]);
9393
}
9494
}, [tiffInfo]);
9595

9696
useEffect(() => {
97-
setImageData({
98-
name: currentVisu.id,
99-
year: Object.keys(currentVisu.imageData)[
100-
Object.keys(currentVisu.imageData).length - 1
101-
],
102-
});
97+
if (currentVisu.id) {
98+
setImageData({
99+
name: currentVisu.id,
100+
year: Object.keys(currentVisu.imageData)[
101+
Object.keys(currentVisu.imageData).length - 1
102+
],
103+
});
104+
}
103105
}, [currentVisu]);
104106

105107
return (

src/utils/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export const sections: ISections = {
7070
};
7171

7272
export const defaultEEInfo: IEEInfo = {
73-
id: "default",
73+
id: "",
7474
name: "--",
7575
description: "--",
7676
imageData: {

0 commit comments

Comments
 (0)