import { title } from "@/settings";
import menu from "@/router/modules/menu";

let fullPathObj = {};

function tranPathObj(menus){
  menus.forEach((item) => {
    if (!item.children || item.children.length == 0) {
      fullPathObj[item.path] = item.title;
    } else {
      return tranPathObj(item.children);
    }
  });
}
tranPathObj(menu);

export default function getPageTitle(fullPath) {
  if (fullPathObj[fullPath]) {
    return `${title} - ${fullPathObj[fullPath]}`
  } else {
    return title;
  }
}
