ปรับ route

This commit is contained in:
setthawutttty 2024-11-14 15:41:18 +07:00
parent 3399f14823
commit 3e6b9a9995
2 changed files with 19 additions and 14 deletions

View file

@ -56,20 +56,25 @@ const path =
import.meta.env.VITE_MANUAL_URL ?? import.meta.env.VITE_MANUAL_URL ??
"https://bma-ehr-manual.frappet.synology.me"; "https://bma-ehr-manual.frappet.synology.me";
const generatePopupPath = (routeName: any) => { const generatePopupPath = (check: any) => {
if (routeName.includes("viewLogs")) { // if (routeName.includes("viewLogs")) {
return `${path}/manual/chapter-2-superadmin-maintenance`; // return `${path}/manual/chapter-2-superadmin-maintenance`;
} // }
if (routeName.includes("manageUsers")) { // if (routeName.includes("manageUsers")) {
return `${path}/manual/chapter-2-superadmin-maintenance`; // return `${path}/manual/chapter-2-superadmin-maintenance`;
} // }
if (routeName.includes("manageRoles")) { // if (routeName.includes("manageRoles")) {
return `${path}/manual/chapter-2-superadmin-maintenance`; // return `${path}/manual/chapter-2-superadmin-maintenance`;
} // }
if (routeName.includes("managePermission")) { // if (routeName.includes("managePermission")) {
// return `${path}/manual/chapter-2-superadmin-maintenance`;
// }
if (!check) {
return `${path}/manual/chapter-1-superadmin-maintenance`;
} else if (check) {
return `${path}/manual/chapter-2-superadmin-maintenance`; return `${path}/manual/chapter-2-superadmin-maintenance`;
} else { } else {
return manualConfig[routeName as keyof typeof manualConfig]; return manualConfig[check as keyof typeof manualConfig];
} }
}; };

View file

@ -303,9 +303,9 @@ function handleButtonClick() {
const currentPath = route.name; const currentPath = route.name;
const queryParams = { role: "admin" }; // Replace with your query parameters const queryParams = { role: "admin" }; // Replace with your query parameters
const queryString = new URLSearchParams(queryParams).toString(); const queryString = new URLSearchParams(queryParams).toString();
const findRole = role.value.includes('SUPER_ADMIN')
// Assuming config.generatePopupPath() returns a base URL // Assuming config.generatePopupPath() returns a base URL
const popupBasePath = config.generatePopupPath(currentPath); const popupBasePath = config.generatePopupPath(findRole);
if (popupBasePath) { if (popupBasePath) {
const popupPath = `${popupBasePath}?${queryString}`; const popupPath = `${popupBasePath}?${queryString}`;