This commit is contained in:
Kenneth Jannette
2024-02-02 22:24:04 -06:00
parent 9ad3ba8aea
commit aa24a7e86a

View File

@@ -20,9 +20,11 @@ const CaseDetailsPage = () => {
const [showCreateModal, setShowCreateModal] = useState();
const [showConfirmModal, setShowConfirmModal] = useState();
const [isLoading, setIsLoading] = useState(false);
const [docsAllowed, setDocsAllowed] = useState(null);
const { appState } = useContext(AppContext);
const { group } = appState;
const appUserId = group ? group.appUserId : null;
const fbUserId = group ? group.fbAuthUid : null;
const message =
"Parsing document. Please be patient, this may take several minutes.";
@@ -51,19 +53,20 @@ const CaseDetailsPage = () => {
useEffect(() => {
const fetchData = async () => {
try {
const docRef = doc(db, "users", "MrKTceLzUKMGHGkiBvhn3cWML8j2");
const docRef = doc(db, "users", fbUserId);
const response = await getDoc(docRef).then(function (doc) {
doc.exists ? setTemp(doc.data()) : console.log("No such document!");
setDocsAllowed(temp.docsAllowedPerMonth);
});
} catch (err) {
console.error(err);
}
};
fetchData();
}, []);
}, [fbUserId]);
const handleUploadDoc = () => {
const allowed = Number(temp.docsAllowed);
const allowed = Number(docsAllowed);
const generated = Number(temp.docsGenerated);
if (allowed - generated > 0) {
setShowUploadModal(true);