diff options
author | 2021-09-06 23:13:22 +0200 | |
---|---|---|
committer | 2021-09-06 23:13:22 +0200 | |
commit | 569bdb8c5d7538fa0ea8a99ff2f8376f7cbfa51a (patch) | |
tree | 8d1cb94a56d60b9d726222277b7516fc59895613 /apps/Notes/helpers/noteActions.js | |
parent | 275bd1d0a9aea90696c145cf992d522a0d6b0aa8 (diff) | |
download | my_apps-569bdb8c5d7538fa0ea8a99ff2f8376f7cbfa51a.tar.gz my_apps-569bdb8c5d7538fa0ea8a99ff2f8376f7cbfa51a.tar.bz2 my_apps-569bdb8c5d7538fa0ea8a99ff2f8376f7cbfa51a.zip |
added stadard linter
Diffstat (limited to 'apps/Notes/helpers/noteActions.js')
-rw-r--r-- | apps/Notes/helpers/noteActions.js | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/apps/Notes/helpers/noteActions.js b/apps/Notes/helpers/noteActions.js index f864e58..d934229 100644 --- a/apps/Notes/helpers/noteActions.js +++ b/apps/Notes/helpers/noteActions.js @@ -4,15 +4,15 @@ import filename from '../helpers/fileName' export const getNote = async (note, setFetchedNote, t, setPopup, callback) => { try { - const {content} = await fetchJson(`/api/notes/${note.noteId}`) - setFetchedNote({ ...note, content}) + const { content } = await fetchJson(`/api/notes/${note.noteId}`) + setFetchedNote({ ...note, content }) callback() } catch (err) { setFetchedNote() setPopup({ content: t('notes_open_error'), time: 2000, - error: true, + error: true }) } } @@ -26,19 +26,19 @@ export const addNote = async (e, mutateNotes, setAction, t, setPopup) => { await fetchJson('/api/notes', { method: 'POST', headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({title, content}), + body: JSON.stringify({ title, content }) }) ) setPopup({ content: t('notes_added'), - time: 2000, + time: 2000 }) setAction('') } catch (e) { setPopup({ - content: t(notes_added_error), + content: t('notes_added_error'), time: 2000, - error: true, + error: true }) } } @@ -46,26 +46,26 @@ export const addNote = async (e, mutateNotes, setAction, t, setPopup) => { export const updateNote = async (e, note, mutateNotes, setAction, t, setPopup) => { const content = e.currentTarget.content.value const title = e.currentTarget.title.value - const {_id, noteId} = note + const { _id, noteId } = note try { mutateNotes( await fetchJson(`/api/notes/${_id}`, { method: 'PUT', headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({title, noteId, content}), + body: JSON.stringify({ title, noteId, content }) }) ) setPopup({ content: t('notes_updated'), - time: 2000, + time: 2000 }) setAction('') } catch (e) { setPopup({ content: t('notes_updated_error'), time: 2000, - error: true, + error: true }) } } @@ -77,34 +77,34 @@ export const removeNote = (e, _id, mutateNotes, t, setPopup, setAction) => { try { await mutateNotes( await fetchJson(`/api/notes/${_id}`, { - method: 'DELETE', + method: 'DELETE' }) ) setPopup({ content: t('notes_removed'), - time: 2000, + time: 2000 }) setAction('') } catch (err) { setPopup({ content: t('notes_removed_error'), time: 2000, - error: true, + error: true }) } } setPopup({ content: t('notes_remove_confirm'), - yes: {label: t('remove'), action: remove}, - no: {label: t('cancel'), action: async () => {}}, - error: true, + yes: { label: t('remove'), action: remove }, + no: { label: t('cancel'), action: async () => {} }, + error: true }) } export const exportNote = async note => { - const {title} = note - const {content} = note.content + const { title } = note + const { content } = note.content ? note : await fetchJson(`/api/notes/${note.noteId}`) |