feature: getRoute inherit extensions
This commit is contained in:
parent
8f5aed11e0
commit
03f67009ab
@ -1,12 +1,17 @@
|
||||
window.hubl.getRoute = (type, returnFirst = false) => {
|
||||
let availables = window.hubl.components.filter(c => c.type == type || c.uniq == type);
|
||||
if (availables.length > 1) {
|
||||
if (returnFirst) {
|
||||
let availables = components.filter(c=>c.type==type||c.uniq==type);
|
||||
availables.map(c => {
|
||||
if(c.extensions) {
|
||||
c.extensions.forEach(e => availables.push(e.type));
|
||||
}
|
||||
});
|
||||
if(availables.length > 1) {
|
||||
if(returnFirst) {
|
||||
return availables[0].route;
|
||||
} else {
|
||||
console.error(`Too much components availables for route ${type}`);
|
||||
return availables[availables.length-1].route;
|
||||
}
|
||||
} else if (availables.length < 1) {
|
||||
} else if(availables.length < 1) {
|
||||
console.error(`No component found for route ${type}`);
|
||||
} else {
|
||||
return availables[0].route;
|
||||
|
Loading…
Reference in New Issue
Block a user