small change

This commit is contained in:
TaylorS15
2023-02-22 18:34:20 -05:00
parent 91df648767
commit 355d6e3cf2
2 changed files with 22 additions and 21 deletions

View File

@@ -41,32 +41,39 @@ export default function APIKeyModal({
function handleCancel() {
async function getRecentDocs() {
const recentDocs = await getLocalRecentDocs();
if (recentDocs) {
setLocalSelectedDocs(recentDocs);
const response = await getLocalRecentDocs();
console.log('response');
if (response) {
const parsedResponse = JSON.parse(response) as Doc;
setLocalSelectedDocs(parsedResponse);
}
}
getRecentDocs();
console.log('cancel');
setIsError(false);
setModalState('INACTIVE');
}
useEffect(() => {
async function getRecentDocs() {
const response = await getLocalRecentDocs();
if (response) {
const parsedResponse = JSON.parse(response) as Doc;
dispatch(setSelectedDocs(parsedResponse));
setLocalSelectedDocs(parsedResponse);
setModalState('INACTIVE');
}
}
async function requestDocs() {
const data = await getDocs();
dispatch(setSourceDocs(data));
}
async function getRecentDocs() {
const recentDocs = await getLocalRecentDocs();
if (recentDocs) {
dispatch(setSelectedDocs(recentDocs));
setLocalSelectedDocs(recentDocs);
setModalState('INACTIVE');
}
}
getRecentDocs();
requestDocs();
}, []);