- {/* */}
+ />
@@ -204,7 +219,7 @@ export default function Navbar({ user }: { user: any }) {
)}
-
+ */}
>
)}
diff --git a/src/index.ts b/src/index.ts
index e3e5f50..8ba8eab 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -307,6 +307,7 @@ ipcMain.handle('questions:read', async (event, question) => {
ipcMain.handle('questions:getall', async (event) => {
const questions = await getAllQuestion();
+ // console.log("questions:getall", questions.length);
return questions;
});
diff --git a/src/utils/state/index.ts b/src/utils/state/index.ts
index ba89966..ae350cc 100644
--- a/src/utils/state/index.ts
+++ b/src/utils/state/index.ts
@@ -156,23 +156,27 @@ export async function getAllQuestion(): Promise
{
const questionFile = path.join(questionDirPath, file);
const questionDataString = fs.readFileSync(questionFile, { encoding: "utf-8" });
- const questionJson: QuestionAnswer = JSON.parse(questionDataString);
-
+ let questionJson: QuestionAnswer;
// TODO remove after update
let chainResTextAsJson;
try {
+ questionJson = JSON.parse(questionDataString);
chainResTextAsJson = JSON.parse(questionJson.chainRes.text);
- if (questionJson.chainRes) {
+ if (questionJson?.chainRes) {
questionJson.chainRes.json = chainResTextAsJson;
}
- } catch (error) { }
-
- return questionJson;
+ return questionJson;
+ } catch (error) {
+ // console.log("error questions.map", { message: error?.message, questionDataString, questionJson });
+ } finally {
+ return questionJson;
+ }
});
return compact(questions);
}
catch (error) {
+ console.log("error getAllQuestion", error?.message);
return null;
}
};