some small changes
This commit is contained in:
@@ -17,6 +17,12 @@ const AccountPage = () => {
|
|||||||
const [docsAllowed, setDocsAllowed] = useState(10);
|
const [docsAllowed, setDocsAllowed] = useState(10);
|
||||||
const appUserId = group ? group.appUserId : null;
|
const appUserId = group ? group.appUserId : null;
|
||||||
const [showModal, setShowModal] = useState(false);
|
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() {
|
function getDocumentsCount() {
|
||||||
if (!appUserId) {
|
if (!appUserId) {
|
||||||
return;
|
return;
|
||||||
@@ -37,10 +43,18 @@ const AccountPage = () => {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleCancelSub = () => {
|
const handleCancelSub = async () => {
|
||||||
setShowModal(true);
|
setShowModal(true);
|
||||||
try {
|
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) {
|
} catch (err) {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user