aboutsummaryrefslogtreecommitdiffstats
path: root/apps/Notes/helpers/noteActions.js
diff options
context:
space:
mode:
Diffstat (limited to 'apps/Notes/helpers/noteActions.js')
-rw-r--r--apps/Notes/helpers/noteActions.js38
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}`)