diff options
| author | JP Dillingham <jpdillingham@gmail.com> | 2022-05-25 23:30:27 -0500 |
|---|---|---|
| committer | JP Dillingham <jpdillingham@gmail.com> | 2022-05-25 23:30:27 -0500 |
| commit | 4c4461bc54cbad68c3ed20ba7faee9625b77c98c (patch) | |
| tree | 783a74d5b33933ce7d6f6ca86f996718f3ef08ff | |
| parent | b34d1d9dfbe379d2f1397b0d2503ec73c4fd9a0d (diff) | |
| download | slskd-4c4461bc54cbad68c3ed20ba7faee9625b77c98c.tar.gz | |
add shares lib
| -rw-r--r-- | src/web/src/lib/shares.js | 19 |
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 |
