chore: refactor response error handling

This commit is contained in:
Ramires Viana committed 2022-05-04 12:11:36 +00:00
1 parent d1d7b23da6
commit 96afaca0ad
16 files changed
+61 -93

No files matched your search

+1 -5
View File
@@ -10,13 +10,9 @@ export async function get(url) {
}
export async function remove(hash) {
const res = await fetchURL(`/api/share/${hash}`, {
await fetchURL(`/api/share/${hash}`, {
method: "DELETE",
});
if (res.status !== 200) {
throw new Error(res.status);
}
}
export async function create(url, password = "", expires = "", unit = "hours") {