aboutsummaryrefslogtreecommitdiffstats
path: root/apps/Notes/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'apps/Notes/helpers')
-rw-r--r--apps/Notes/helpers/export.js2
-rw-r--r--apps/Notes/helpers/noteActions.js16
2 files changed, 8 insertions, 10 deletions
diff --git a/apps/Notes/helpers/export.js b/apps/Notes/helpers/export.js
index 80fa100..4a0db9c 100644
--- a/apps/Notes/helpers/export.js
+++ b/apps/Notes/helpers/export.js
@@ -23,7 +23,7 @@ export const handleExport = (e, ids, notes) => {
Promise.all(ids.map(async id => {
const title = notes.find(n => n.noteId === id).title
- const {content} = await fetchJson(`/api/note/${id}`)
+ const {content} = await fetchJson(`/api/notes/${id}`)
zip.folder('notes').file(filename(title), content, {binary: true})
})).then(() => {
zip.generateAsync({type:"blob"})
diff --git a/apps/Notes/helpers/noteActions.js b/apps/Notes/helpers/noteActions.js
index f67e7a4..f864e58 100644
--- a/apps/Notes/helpers/noteActions.js
+++ b/apps/Notes/helpers/noteActions.js
@@ -4,7 +4,7 @@ import filename from '../helpers/fileName'
export const getNote = async (note, setFetchedNote, t, setPopup, callback) => {
try {
- const {content} = await fetchJson(`/api/note/${note.noteId}`)
+ const {content} = await fetchJson(`/api/notes/${note.noteId}`)
setFetchedNote({ ...note, content})
callback()
} catch (err) {
@@ -50,10 +50,10 @@ export const updateNote = async (e, note, mutateNotes, setAction, t, setPopup) =
try {
mutateNotes(
- await fetchJson('/api/notes', {
+ await fetchJson(`/api/notes/${_id}`, {
method: 'PUT',
headers: { 'Content-Type': 'application/json' },
- body: JSON.stringify({_id, title, noteId, content}),
+ body: JSON.stringify({title, noteId, content}),
})
)
setPopup({
@@ -76,10 +76,8 @@ export const removeNote = (e, _id, mutateNotes, t, setPopup, setAction) => {
const remove = async () => {
try {
await mutateNotes(
- await fetchJson('/api/notes', {
+ await fetchJson(`/api/notes/${_id}`, {
method: 'DELETE',
- headers: { 'Content-Type': 'application/json' },
- body: JSON.stringify({_id}),
})
)
setPopup({
@@ -98,8 +96,8 @@ export const removeNote = (e, _id, mutateNotes, t, setPopup, setAction) => {
setPopup({
content: t('notes_remove_confirm'),
- yes: { label: t('remove'), action: remove },
- no: { label: t('cancel'), action: async () => {} },
+ yes: {label: t('remove'), action: remove},
+ no: {label: t('cancel'), action: async () => {}},
error: true,
})
}
@@ -108,7 +106,7 @@ export const exportNote = async note => {
const {title} = note
const {content} = note.content
? note
- : await fetchJson(`/api/note/${note.noteId}`)
+ : await fetchJson(`/api/notes/${note.noteId}`)
saveFile(content, filename(title), 'text/plain')
}