more
This commit is contained in:
@@ -25,6 +25,7 @@ import "../../styles/docedit-page.scss";
|
||||
const DocEditPage = () => {
|
||||
const { documentId, responseGenerations, caseId, documentType } = useParams();
|
||||
const navigate = useNavigate();
|
||||
const [docType, setDocType] = useState(documentType);
|
||||
const [parsedRogs, setParsedRogs] = useState();
|
||||
const [responses, setResponses] = useState([1]);
|
||||
const [fetchedCase, setFetchedCase] = useState();
|
||||
@@ -127,7 +128,8 @@ const DocEditPage = () => {
|
||||
];
|
||||
|
||||
/*
|
||||
* GET docuement data from Firebase
|
||||
* GET document data from Firebase
|
||||
*
|
||||
* */
|
||||
|
||||
useEffect(() => {
|
||||
@@ -213,6 +215,12 @@ const DocEditPage = () => {
|
||||
const unsub = onSnapshot(docRef, (snapshot) => {
|
||||
if (snapshot.exists() && snapshot.data().ownerId === appUserId) {
|
||||
setDocument({ ...snapshot.data(), documentId: snapshot.id });
|
||||
if (
|
||||
docType === undefined ||
|
||||
(docType === null && document.length > 1)
|
||||
) {
|
||||
setDocType(document.docType);
|
||||
}
|
||||
} else {
|
||||
setDocument(null);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user