fix(routing): handle empty boardPath and resolve directory codes

This commit is contained in:
plebeius
2025-11-07 18:54:45 +01:00
parent 128b6b1986
commit b886cbdf3b
3 changed files with 41 additions and 25 deletions
+12 -2
View File
@@ -45,7 +45,12 @@ const CatalogButton = ({ address, isInAllView, isInSubscriptionsView, isInModVie
if (params?.timeFilterName) return `/mod/catalog/${params.timeFilterName}`;
return `/mod/catalog`;
}
const boardPath = address ? getBoardPath(address, defaultSubplebbits) : defaultSubplebbits || '';
let boardPath = '';
if (address) {
boardPath = getBoardPath(address, defaultSubplebbits);
} else if (Array.isArray(defaultSubplebbits) && defaultSubplebbits.length > 0 && defaultSubplebbits[0]?.address) {
boardPath = getBoardPath(defaultSubplebbits[0].address, defaultSubplebbits);
}
return `/${boardPath}/catalog`;
};
@@ -83,7 +88,12 @@ const ReturnButton = ({ address, isInAllView, isInSubscriptionsView, isInModView
if (params?.timeFilterName) return `/mod/${params.timeFilterName}`;
return `/mod`;
}
const boardPath = address ? getBoardPath(address, defaultSubplebbits) : defaultSubplebbits || '';
let boardPath = '';
if (address) {
boardPath = getBoardPath(address, defaultSubplebbits);
} else if (Array.isArray(defaultSubplebbits) && defaultSubplebbits.length > 0 && defaultSubplebbits[0]?.address) {
boardPath = getBoardPath(defaultSubplebbits[0].address, defaultSubplebbits);
}
return `/${boardPath}`;
};