Skip to content

Commit

Permalink
fix: rewrites not working
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon committed Nov 20, 2019
1 parent fad482d commit 1a3cab9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions docs/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,9 @@ module.exports = {

return map;
},
async rewrites() {
return [{ source: '/api/:rest*', destination: '/api-docs/:rest' }];
experimental: {
async rewrites() {
return [{ source: '/api/:rest*', destination: '/api-docs/:rest*' }];
},
},
};
2 changes: 1 addition & 1 deletion docs/src/modules/components/AppDrawer.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ function reduceChildRoutes({ props, activePage, items, page, depth, t }) {
depth={depth}
key={title}
title={title}
href={page.pathname}
href={page.pathname.replace(/^\/api-docs\/(.*)/, '/api/$1')}
onClick={props.onClose}
/>,
);
Expand Down
2 changes: 1 addition & 1 deletion docs/src/modules/utils/find.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ function findPages(
if (
options.front &&
pathname.indexOf('/components') === -1 &&
pathname.indexOf('/api') === -1
pathname.indexOf('/api-docs') === -1
) {
return;
}
Expand Down

0 comments on commit 1a3cab9

Please sign in to comment.