fix(codeAreaModal): move postCustomComponent call inside else block to prevent unnecessary API calls when condition is false
fix(codeAreaModal): remove commented out code for axios.get call
This commit is contained in:
parent
48345dd8dd
commit
8b0a39f6ee
1 changed files with 11 additions and 9 deletions
|
|
@ -104,17 +104,19 @@ export default function CodeAreaModal({
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
postCustomComponent(code, nodeClass).then((apiReturn) => {
|
||||||
|
const {data} = apiReturn;
|
||||||
|
if (data) {
|
||||||
|
setNodeClass(data);
|
||||||
|
setModalOpen(false);
|
||||||
|
}
|
||||||
|
}).catch((err) => {
|
||||||
|
console.log(err.response.data);
|
||||||
|
setError(err.response.data);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
postCustomComponent(code, nodeClass).then((apiReturn) => {
|
|
||||||
const {data} = apiReturn;
|
|
||||||
if (data) {
|
|
||||||
setNodeClass(data);
|
|
||||||
setModalOpen(false);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
// axios.get("/api/v1/custom_component_error").catch((err) => {
|
// axios.get("/api/v1/custom_component_error").catch((err) => {
|
||||||
// console.log(err.response.data);
|
|
||||||
// setError(err.response.data);
|
|
||||||
// })
|
// })
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue