diff --git a/src/Components/Account/AccountPage.js b/src/Components/Account/AccountPage.js index 49613f5..d88f85e 100644 --- a/src/Components/Account/AccountPage.js +++ b/src/Components/Account/AccountPage.js @@ -17,6 +17,12 @@ const AccountPage = () => { const [docsAllowed, setDocsAllowed] = useState(10); const appUserId = group ? group.appUserId : null; const [showModal, setShowModal] = useState(false); + + const apiUrl = + process.env.NODE_ENV === "development" + ? process.env.REACT_APP_API_DEV + : process.env.REACT_APP_API_PROD; + function getDocumentsCount() { if (!appUserId) { return; @@ -37,10 +43,18 @@ const AccountPage = () => { return null; } - const handleCancelSub = () => { + const handleCancelSub = async () => { setShowModal(true); try { - //API call(s) + let response = await fetch(`${apiUrl}/cancel-subscription`, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify({ + appUserId: appUserId, + }), + }) } catch (err) { console.log(err); }