File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ export async function GET(request: Request) {
2727 const docData = getDocument ( {
2828 folder : folder ,
2929 document : document ,
30+ withGenerals : true ,
3031 } ) ;
3132
3233 if ( ! docData ) {
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ type Doc = Document &
2828interface GetDocument {
2929 folder : string ;
3030 document : string ;
31+ withGenerals ?: boolean ;
3132}
3233
3334const normalizePath = ( path : string ) : string => {
@@ -42,12 +43,19 @@ const allDocs = allDocsArray.filter(
4243 ) ,
4344) ;
4445
45- const getDocument = ( { folder, document } : GetDocument ) : Doc | undefined => {
46+ const getDocument = ( {
47+ folder,
48+ document,
49+ withGenerals,
50+ } : GetDocument ) : Doc | undefined => {
4651 const normalizedDocument = normalizePath ( document ) ;
4752 const doc = allDocs . find ( ( doc ) => {
4853 const normalizedPath = normalizePath ( doc . _meta . path ) ;
4954 return doc . folder === folder && normalizedPath === normalizedDocument ;
5055 } ) ;
56+ if ( ! doc && withGenerals ) {
57+ return getGeneralDocument ( document ) ;
58+ }
5159 if ( ! doc ) {
5260 return undefined ;
5361 }
You can’t perform that action at this time.
0 commit comments