From 1f9e811f43355ada8491fa3e726cc1cb2185f3c3 Mon Sep 17 00:00:00 2001 From: Gwynn Dandridge-Perry Date: Tue, 3 May 2022 18:28:26 -0700 Subject: [PATCH] feat: add confirmation pop up before unlinking/deleting a stakeholder --- src/api/stakeholders.js | 2 -- .../Stakeholders/StakeholderDetail/List.js | 15 ++++++++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/api/stakeholders.js b/src/api/stakeholders.js index 28194ef9f..39762df67 100644 --- a/src/api/stakeholders.js +++ b/src/api/stakeholders.js @@ -12,8 +12,6 @@ export default { getStakeholders(id, filter) { const orgId = id || getOrganizationId(); - console.log('getStakeholders', orgId, filter); - const where = Object.keys(filter).reduce((acc, key) => { if (filter[key] !== '') { acc += `&${key}=${filter[key]}`; diff --git a/src/components/Stakeholders/StakeholderDetail/List.js b/src/components/Stakeholders/StakeholderDetail/List.js index bdf198055..0be6efd5c 100644 --- a/src/components/Stakeholders/StakeholderDetail/List.js +++ b/src/components/Stakeholders/StakeholderDetail/List.js @@ -21,11 +21,16 @@ function StakeholderList({ id, data, type, linked }) { const handleChange = (e, data) => { setIsLinked(!isLinked); - deleteStakeholder(id, { - type, - linked: !linked, - data: data, - }); + const confirmed = window.confirm( + 'Are you sure? Continuing will delete the stakeholder from the system.' + ); + if (confirmed) { + deleteStakeholder(id, { + type, + linked: !linked, + data: data, + }); + } }; return (