diff --git a/web/src/components/DiaryEditor.vue b/web/src/components/DiaryEditor.vue
index 07cfad3..27a2d3b 100644
--- a/web/src/components/DiaryEditor.vue
+++ b/web/src/components/DiaryEditor.vue
@@ -4,6 +4,8 @@
+ {{ date }}
+ {{ content }}
@@ -36,9 +38,9 @@ const extensions = createExtensions();
const content = ref({});
const noteJsonRef = ref(null);
-
+const queryKey = computed(() => ['diaryContent', props.date]);
const { data: noteData } = useQuery({
- queryKey: ['diaryContent', props.date],
+ queryKey: queryKey,
queryFn: () => fetchNote(props.date),
// TODO: fix the onError removed from the useQuery issue
onError: (error) => {
@@ -54,8 +56,12 @@ const { data: noteData } = useQuery({
watch(noteData, (newData) => {
if (newData) {
- const noteObj = JSON.parse(newData.note);
- content.value = noteObj;
+ if (newData.note) {
+ const noteObj = JSON.parse(newData.note);
+ content.value = noteObj;
+ } else {
+ content.value = {};
+ }
}
});
diff --git a/web/src/views/Home.vue b/web/src/views/Home.vue
index 7fc96f8..53de62b 100644
--- a/web/src/views/Home.vue
+++ b/web/src/views/Home.vue
@@ -1,8 +1,6 @@
-
-
{{ time }}
@@ -25,7 +23,7 @@
+
+
+
+
-
+