add: finish forge stuff

This commit is contained in:
trisua 2025-06-10 22:02:06 -04:00
parent 53fb4d5778
commit 68071b96c8
21 changed files with 329 additions and 18 deletions

View file

@ -135,6 +135,31 @@
});
});
self.define("update_open", async (_, id, status) => {
if (
!(await trigger("atto::confirm", [
"Are you sure you want to do this?",
]))
) {
return;
}
fetch(`/api/v1/posts/${id}/open`, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({ open: status }),
})
.then((res) => res.json())
.then((res) => {
trigger("atto::toast", [
res.ok ? "success" : "error",
res.message,
]);
});
});
self.define("react", async (_, element, asset, asset_type, is_like) => {
await trigger("atto::debounce", ["reactions::toggle"]);
fetch("/api/v1/reactions", {