change pagination number

This commit is contained in:
2024-06-20 17:49:30 +07:00
parent 664c041acf
commit 5826d72988
4 changed files with 20 additions and 2 deletions

View File

@@ -41,7 +41,14 @@ templ DashboardPic(
}
templ JSDashboardPIC() {
<script>
document.body.addEventListener('htmx:configRequest', function(evt) {
const token = localStorage.getItem("token");
if (token) {
evt.detail.headers['Authentication'] = "Bearer " + token;
}
});
</script>
}
templ CSSDashboardPIC() {

View File

@@ -104,6 +104,10 @@ func JSDashboardPIC() templ.Component {
templ_7745c5c3_Var2 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<script>\r\n\t\tdocument.body.addEventListener('htmx:configRequest', function(evt) {\r\n\t\t\tconst token = localStorage.getItem(\"token\");\r\n\t\t\tif (token) {\r\n\t\t\t\tevt.detail.headers['Authentication'] = \"Bearer \" + token;\r\n\t\t\t}\r\n\t\t});\t\r\n\t</script>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
if !templ_7745c5c3_IsBuffer {
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
}

View File

@@ -152,6 +152,13 @@ templ JSDashboardPat() {
}
});
document.body.addEventListener('htmx:configRequest', function(evt) {
const token = localStorage.getItem("token");
if (token) {
evt.detail.headers['Authentication'] = "Bearer " + token;
}
});
</script>
}

View File

@@ -267,7 +267,7 @@ func JSDashboardPat() templ.Component {
templ_7745c5c3_Var7 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<script>\r\n document.addEventListener(`DOMContentLoaded`, (event) => {\r\n const data = localStorage.getItem(`user`);\r\n if (data) {\r\n const parsedData = JSON.parse(data);\r\n // console.log(parsedData.M_UserEmail);\r\n document.getElementById('userEmail').value = parsedData.M_UserEmail;\r\n \r\n }\r\n });\r\n </script>")
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<script>\r\n document.addEventListener(`DOMContentLoaded`, (event) => {\r\n const data = localStorage.getItem(`user`);\r\n if (data) {\r\n const parsedData = JSON.parse(data);\r\n // console.log(parsedData.M_UserEmail);\r\n document.getElementById('userEmail').value = parsedData.M_UserEmail;\r\n \r\n }\r\n });\r\n \r\n\t\tdocument.body.addEventListener('htmx:configRequest', function(evt) {\r\n\t\t\tconst token = localStorage.getItem(\"token\");\r\n\t\t\tif (token) {\r\n\t\t\t\tevt.detail.headers['Authentication'] = \"Bearer \" + token;\r\n\t\t\t}\r\n\t\t});\t \r\n </script>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}