diff --git a/app/dashboard/templates/dashboard/index.html b/app/dashboard/templates/dashboard/index.html
index 2d03b940..0680c5bd 100644
--- a/app/dashboard/templates/dashboard/index.html
+++ b/app/dashboard/templates/dashboard/index.html
@@ -253,6 +253,7 @@
@@ -422,7 +424,6 @@
let aliasId = $(this).data("alias");
let alias = $(this).parent().find(".alias").val();
-
try {
let res = await fetch(`/api/aliases/${aliasId}/toggle`, {
method: "POST",
@@ -453,6 +454,37 @@
var oldValue = !$(this).prop("checked");
$(this).prop("checked", oldValue);
}
+ })
+
+ $(".save-note").on("click", async function () {
+ let aliasId = $(this).data("alias");
+ let note = $(`#note-${aliasId}`).val();
+
+ try {
+ let res = await fetch(`/api/aliases/${aliasId}`, {
+ method: "PUT",
+ headers: {
+ "Content-Type": "application/json",
+ },
+ body: JSON.stringify({
+ note: note,
+ }),
+ });
+
+ if (res.ok) {
+ toastr.success(`Saved`);
+ } else {
+ toastr.error("Sorry for the inconvenience! Could you refresh the page & retry please?", "Unknown Error");
+ // reset to the original value
+ var oldValue = !$(this).prop("checked");
+ $(this).prop("checked", oldValue);
+ }
+ } catch (e) {
+ toastr.error("Sorry for the inconvenience! Could you refresh the page & retry please?", "Unknown Error");
+ // reset to the original value
+ var oldValue = !$(this).prop("checked");
+ $(this).prop("checked", oldValue);
+ }
})