From 4c4461bc54cbad68c3ed20ba7faee9625b77c98c Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Wed, 25 May 2022 23:30:27 -0500 Subject: add shares lib --- src/web/src/lib/shares.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/web/src/lib/shares.js (limited to 'src') 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 -- cgit v1.2.3