aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/web/src/lib/shares.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/web/src/lib/shares.js b/src/web/src/lib/shares.js
new file mode 100644
index 00000000..34fab679
--- /dev/null
+++ b/src/web/src/lib/shares.js
@@ -0,0 +1,19 @@
+import api from './api';
+
+export const getAll = async () => {
+ return (await api.get('/shares')).data;
+};
+
+export const get = async ({ id } = {}) => {
+ if (!id) throw new Error('unable to get share: id is missing');
+ return (await api.get(`/shares/${id}`)).data;
+};
+
+export const browseAll = async () => {
+ return (await api.get('/shares/contents')).data;
+};
+
+export const browse = async ({ id } = {}) => {
+ if (!id) throw new Error('unable to get share contents: id is missing');
+ return (await api.get(`/shares/${id}/contents`)).data;
+}; \ No newline at end of file