summaryrefslogtreecommitdiff
path: root/issues
diff options
context:
space:
mode:
authorAlexander_Kabui2024-05-14 13:46:55 +0300
committerAlexander_Kabui2024-05-14 13:46:55 +0300
commitb44d577124ae6fb5e62674528060289c0d31fd6a (patch)
treeffb865a86716f17b3e0e58ffdea92c7b53bfa59e /issues
parenta8d1eacdc9dc72f44b129267cb659c5b84009069 (diff)
downloadgn-gemtext-b44d577124ae6fb5e62674528060289c0d31fd6a.tar.gz
Add new issue: error handling using htmx javascript api.
Diffstat (limited to 'issues')
-rw-r--r--issues/htmx-error-handling.gmi42
1 files changed, 42 insertions, 0 deletions
diff --git a/issues/htmx-error-handling.gmi b/issues/htmx-error-handling.gmi
new file mode 100644
index 0000000..e8612fe
--- /dev/null
+++ b/issues/htmx-error-handling.gmi
@@ -0,0 +1,42 @@
+# Bug when using HTMX Ajax Post request
+
+## Tags
+
+* type: bug
+* priority: high
+* status: open
+* assigned: alexm
+* keywords: url
+
+## Description
+The issue occurs when you send a post request using HTMX javascript Api.this does
+not provide a well defined to handle errors from the callback
+A code snippet can be show below
+
+```js
+ htmx.on("#upvote", "click", function(evt){
+ vote_count = htmx.find(".btn-success") ? 0 : 1
+ htmx.ajax("POST", `/gnqna/rating/${task_id}/${vote_count}`, {target: "#rate", swap:"innerHTML",values: {'query': query, 'answer': answer}}).then(()=>{
+ htmx.toggleClass(htmx.find('#upvote'), 'btn-success');
+ htmx.removeClass(htmx.find("#downvote"), "btn-danger");
+})
+.catch((err)=>{
+alert("html")
+})
+});
+```
+In the above snipped incase of a response error you would expert the catch method
+method to be invoked but that doesn'tn occur
+This is the htmx docs which does not provide a proper error handling mechanism
+
+=> https://htmx.org/api/
+
+## Note
+the reason for using the htmx javascript api is to toggle the rating class for
+both like and dislike functionality depending if the requests fails or succeeds
+
+
+
+
+
+