Skip to content
Snippets Groups Projects
Commit d2b5efef authored by Trirst's avatar Trirst
Browse files

Fix delete action

parent 8a106bc1
Branches
No related tags found
No related merge requests found
...@@ -53,15 +53,17 @@ ...@@ -53,15 +53,17 @@
fetchAPI(paths.ImageField(snowflake), options); fetchAPI(paths.ImageField(snowflake), options);
} }
// Delete the image then reroute back to /browse?p=1 // Delete the image then reroute back to /browse?p=1
// I don't know why the fuck this works but just leave it here
async function deleteImage(snowflake) { async function deleteImage(snowflake) {
if (confirm("Delete image?")) { if (confirm("Delete image?")) {
const options = { const options = {
method: "DELETE", method: "DELETE",
headers: { secret: $user.secret }, headers: { secret: $user.secret },
}; };
fetchAPI(paths.ImageField(snowflake), options); // .finally is to cope with fetchAPI resolving to error when
push("#/browse?p=1"); // an endpoint returns empty JSON
fetchAPI(paths.ImageField(snowflake), options).finally(() =>
push("#/browse?p=1")
);
} }
} }
</script> </script>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment