เพิ่ม query string

This commit is contained in:
AnandaTon 2024-06-28 13:06:00 +07:00
parent 7bb72d96f9
commit f46ef6bd8e

View file

@ -477,14 +477,17 @@ watch(
const handleButtonClick = () => {
const currentPath = route.name;
// const popupPath =
// config.manualConfig[currentPath as keyof typeof config.manualConfig];
const popupPath = config.generatePopupPath(currentPath);
if (popupPath) {
// console.log(currentPath);
window.open(popupPath);
const queryParams = { role: "officer" }; // Replace with your query parameters
const queryString = new URLSearchParams(queryParams).toString();
// Assuming config.generatePopupPath() returns a base URL
const popupBasePath = config.generatePopupPath(currentPath);
if (popupBasePath) {
const popupPath = `${popupBasePath}?${queryString}`;
window.open(popupPath, "_blank"); // Opens in a new tab/window
} else {
console.log("no manual in this page ", currentPath);
console.log("No manual available for this page:", currentPath);
}
};
</script>