Add nanoid

This commit is contained in:
Chris Veleris 2025-08-04 23:43:36 +03:00 committed by Chris
parent e081ed622a
commit 3599bc2b60
50 changed files with 1803 additions and 377 deletions

View file

@ -51,3 +51,13 @@ export const deleteNote = async (noteId: number): Promise<void> => {
await handleAuthResponse(response, 'Failed to delete note.');
};
export const fetchNoteBySlug = async (nanoidSlug: string): Promise<Note> => {
const response = await fetch(`/api/note/${nanoidSlug}`, {
credentials: 'include',
headers: getDefaultHeaders(),
});
await handleAuthResponse(response, 'Failed to fetch note.');
return await response.json();
};