Added error handling
This commit is contained in:
parent
4e7a0fcc32
commit
598cd04b31
1 changed files with 11 additions and 5 deletions
|
|
@ -50,13 +50,13 @@ export default function CollectionCardComponent({
|
||||||
const newFlow = cloneFLowWithParent(res, res.id, data.is_component);
|
const newFlow = cloneFLowWithParent(res, res.id, data.is_component);
|
||||||
addFlow(true, newFlow)
|
addFlow(true, newFlow)
|
||||||
.then((id) => {
|
.then((id) => {
|
||||||
setSuccessData({ title: `${name} Installed` });
|
setSuccessData({ title: `${name} Installed Successfully.` });
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
setErrorData({
|
setErrorData({
|
||||||
title: `There was an error installing the ${name}`,
|
title: `Error installing the ${name}`,
|
||||||
list: [error["response"]["data"]["detail"]],
|
list: [error["response"]["data"]["detail"]],
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
@ -84,9 +84,15 @@ export default function CollectionCardComponent({
|
||||||
setLoadingLike(false);
|
setLoadingLike(false);
|
||||||
setLikes_count(tempNum);
|
setLikes_count(tempNum);
|
||||||
setLiked_by_user(temp);
|
setLiked_by_user(temp);
|
||||||
|
if (error.response.status === 403) {
|
||||||
setValidApiKey(false);
|
setValidApiKey(false);
|
||||||
console.error(error);
|
} else {
|
||||||
|
console.error(error);
|
||||||
|
setErrorData({
|
||||||
|
title: `Error liking ${name}.`,
|
||||||
|
list: [error["response"]["data"]["detail"]],
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue