Merged PR 2385: update unsubscribe

update unsubscribe

Related work items: #23796
This commit is contained in:
Robert Bond
2026-06-11 13:04:21 +00:00
parent 3297fe4f16
commit 628b2b71fd
+21 -6
View File
@@ -102,16 +102,31 @@ const deleteWatchedCases = async (watchedCaseID) => {
return axios(config)
.then(({ data }) => {
console.log("deleted watched case - " + watchedCaseID);
res.status(200).json(data);
// Return a JSON object for success
return {
success: true,
message: "Case deleted successfully",
data: data
};
})
.catch((error) => {
console.log("err----:", error);
if (error.response && error.response.status === 404) {
console.warn("Record not found — nothing to delete.");
return { success: false, caseRef: "Not found" };
return {
success: false,
error: "Not found",
caseRef: "Not found"
};
} else {
consoleLogger(error);
//res.status(400).json(error);
// Return a JSON object for general errors
return {
success: false,
error: error.message || "An error occurred during deletion",
details: error.response ? error.response.data : null
};
}
});
};
@@ -133,11 +148,11 @@ export const getServerSideProps = wrapper.getServerSideProps(
console.log("is there a caseObj", hasUnsubscribed);
//const deleteCase = await deleteWatchedCases(query.watchlistid);
const deleteCase = await deleteWatchedCases(query.watchlistid);
hasUnsubscribed && (await deleteWatchedCases(query.watchlistid));
//hasUnsubscribed && (await deleteWatchedCases(query.watchlistid));
//console.log(deleteCase);
console.log(deleteCase);
return {
props: {
caseRef: hasUnsubscribed