refac
This commit is contained in:
@@ -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';
|
||||
|
||||
@@ -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';
|
||||
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user