Skip to content
Snippets Groups Projects
Commit 03f67009 authored by Jean-Baptiste Pasquier's avatar Jean-Baptiste Pasquier
Browse files

feature: getRoute inherit extensions

parent 8f5aed11
No related branches found
No related tags found
1 merge request!301Release/core 0.17
Pipeline #11387 passed
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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment