aboutsummaryrefslogtreecommitdiffstats
path: root/api.js
diff options
context:
space:
mode:
authorGravatar piotrruss <mail@pruss.it> 2022-05-22 13:49:12 +0100
committerGravatar piotrruss <mail@pruss.it> 2022-05-22 13:49:12 +0100
commit994bc43d488eefc0ee39f39dd7fae5515322b17b (patch)
tree64872194dbcc1112f1850dd94fd4c3185c1a6d6f /api.js
parent853aefca82243a574e3fd8d5e5c7270355ba0cdb (diff)
downloadnotes_mobile-994bc43d488eefc0ee39f39dd7fae5515322b17b.tar.gz
notes_mobile-994bc43d488eefc0ee39f39dd7fae5515322b17b.tar.bz2
notes_mobile-994bc43d488eefc0ee39f39dd7fae5515322b17b.zip
move api & helpers to utils
Diffstat (limited to 'api.js')
-rw-r--r--api.js31
1 files changed, 0 insertions, 31 deletions
diff --git a/api.js b/api.js
deleted file mode 100644
index 3441967..0000000
--- a/api.js
+++ /dev/null
@@ -1,31 +0,0 @@
-const API = 'https://apps.pruss.it/api'
-
-export const login = ({ email, password }) => fetch(`${API}/login`, {
- method: 'POST',
- headers: { 'Content-Type': 'plain/text; charset=utf-8' },
- body: JSON.stringify({ email, password })
-})
-
-export const getList = ({ session }) => fetch(`${API}/notes`, {
- 'Cookie': session.cookies
-})
-
-export const getNote = ({ note, session }) => fetch(`${API}/notes/${note.noteId}`, {
- method: 'GET', headers: { 'Cookie': session.cookies },
-})
-
-export const createNote = ({ title, content, session }) => fetch(`${API}/notes`, {
- method: 'POST',
- headers: { 'Content-Type': 'plain/text; charset=utf-8', 'Cookie': session.cookies },
- body: JSON.stringify({ title, content })
-})
-
-export const editNote = ({ note, title, content, session }) => fetch(`${API}/notes/${note._id}`, {
- method: 'PUT',
- headers: { 'Content-Type': 'plain/text; charset=utf-8', 'Cookie': session.cookies },
- body: JSON.stringify({ title, noteId: note.noteId, content })
-})
-
-export const removeNote = ({ note, session }) => fetch(`${API}/notes/${note._id}`, {
- method: 'DELETE', headers: { 'Cookie': session.cookies },
-})