This commit is contained in:
Timothy Jaeryang Baek
2025-11-19 14:14:53 -05:00
parent 17389e1b66
commit aad23e2e53
6 changed files with 36 additions and 31 deletions
+1 -1
View File
@@ -8,7 +8,7 @@
import { goto } from '$app/navigation';
import { page } from '$app/stores';
import { createNoteHandler } from './utils';
import { createNoteHandler } from '$lib/components/notes/utils';
import UserMenu from '$lib/components/layout/Sidebar/UserMenu.svelte';
import Notes from '$lib/components/notes/Notes.svelte';
+1 -1
View File
@@ -6,7 +6,7 @@
import { showSidebar } from '$lib/stores';
import dayjs from '$lib/dayjs';
import { createNoteHandler } from '../utils';
import { createNoteHandler } from '$lib/components/notes/utils';
import NoteEditor from '$lib/components/notes/NoteEditor.svelte';
+1 -1
View File
@@ -5,7 +5,7 @@
import { page } from '$app/stores';
import dayjs from '$lib/dayjs';
import { createNoteHandler } from '../utils';
import { createNoteHandler } from '$lib/components/notes/utils';
onMount(async () => {
const title = $page.url.searchParams.get('title') ?? dayjs().format('YYYY-MM-DD');
-26
View File
@@ -1,26 +0,0 @@
import { createNewNote } from '$lib/apis/notes';
import { toast } from 'svelte-sonner';
export const createNoteHandler = async (title: string, content?: string) => {
// $i18n.t('New Note'),
const res = await createNewNote(localStorage.token, {
// YYYY-MM-DD
title: title,
data: {
content: {
json: null,
html: content ?? '',
md: content ?? ''
}
},
meta: null,
access_control: {}
}).catch((error) => {
toast.error(`${error}`);
return null;
});
if (res) {
return res;
}
};