Skip to content

Commit

Permalink
Update getRouterPath
Browse files Browse the repository at this point in the history
  • Loading branch information
onurtemizkan committed Jul 30, 2024
1 parent 61a57d1 commit 6804892
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ export const storeLayerPath = (request: PatchedRequest, value?: string) => {
* @returns The reconstructed path
*/
export const getRouterPath = (path: string, layer: ExpressLayer): string => {
const stackLayer = layer.handle?.stack[0];
const stackLayer = layer.handle?.stack?.[0];

if (stackLayer.route?.path) {
if (stackLayer?.route?.path) {
return `${path}${stackLayer.route.path}`;
}

if (stackLayer.handle?.stack) {
if (stackLayer?.handle?.stack) {
return getRouterPath(path, stackLayer);
}

Expand Down

0 comments on commit 6804892

Please sign in to comment.