-drag menu continua
This commit is contained in:
@@ -11191,18 +11191,16 @@ export const tools = {
|
||||
getmenuByPath(path: string) {
|
||||
const myroutes = static_data.routes;
|
||||
|
||||
const normalized = this.norm(path);
|
||||
const norm = path ? (path.startsWith('/') ? path : `/${path}`).trim().toLowerCase() : undefined;
|
||||
|
||||
const mymenus = myroutes.find((menu: any) => menu.path === normalized);
|
||||
const mymenus = myroutes.find((menu: any) => menu.path === norm);
|
||||
|
||||
// console.log('mymenus', mymenus, 'path', path, 'norm', norm);
|
||||
|
||||
return mymenus;
|
||||
},
|
||||
|
||||
norm(path: string): string {
|
||||
return path
|
||||
.trim()
|
||||
.replace(/^\/+|\/+$/g, '')
|
||||
.toLowerCase();
|
||||
norm(path?: string): string | undefined {
|
||||
return typeof path === 'string' ? path.trim().replace(/^\/+|\/+$/g, '').toLowerCase() : undefined;
|
||||
},
|
||||
|
||||
// FINE !
|
||||
|
||||
@@ -1476,6 +1476,12 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
return Api.SendReq('/savepage', 'POST', { page })
|
||||
.then((res) => {
|
||||
if (res && res.data && res.data.mypage) {
|
||||
const index = this.mypage.findIndex((rec) => rec.path === res.data.mypage.path);
|
||||
if (index >= 0) {
|
||||
this.mypage[index] = res.data.mypage;
|
||||
} else {
|
||||
this.mypage.push(res.data.mypage);
|
||||
}
|
||||
return res.data.mypage;
|
||||
} else {
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user