File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ export default function Home() {
3434 try {
3535 const responseBranch = await fetchTreeSHA ( owner , repo , branch )
3636 const treeSHA = responseBranch [ "commit" ] [ "commit" ] [ "tree" ] [ "sha" ]
37- console . log ( treeSHA )
37+ // console.log(treeSHA)
3838 const response = await axios . get ( `https://api.github.com/repos/${ owner } /${ repo } /git/trees/${ treeSHA } ` , {
3939 params : {
4040 recursive : recursive ? "true" : "false"
Original file line number Diff line number Diff line change @@ -29,7 +29,6 @@ export default function CodeBlock({ children: rawChildren, ...props }) {
2929 const getRepositoryContents = async ( owner , repo , path = '' ) => {
3030 try {
3131 const response = await axios . get ( `https://api.github.com/repos/${ owner } /${ repo } /contents/${ path } ` ) ;
32- console . log ( path ) ;
3332 return response . data ;
3433 } catch ( error ) {
3534 console . error ( 'Error fetching repository contents:' , error ) ;
@@ -65,15 +64,17 @@ export default function CodeBlock({ children: rawChildren, ...props }) {
6564 }
6665 } ;
6766
68- const pattern = / ^ [ a - z A - Z ] + - [ a - z A - Z ] + \/ \d + \/ \d + \/ \d + $ / ;
67+ // const pattern = /^[a-zA-Z]+-[a-zA-Z]+\/\d+\/\d+\/\d+$/;
68+ // const pattern = /^[a-zA-Z]+-[a-zA-Z]+\/[a-zA-Z]+-\d+\/\d+-[a-zA-Z]+-[a-zA-Z]+\/\d+$/;
69+ const pattern = / ^ ( l e e t - c o d e | n o v i c e - h i g h ) \/ .+ \/ .+ \/ .+ $ / ;
6970 if ( ( pattern . test ( props . metastring ) === true ) && ( props . className === "language-python" ) ) {
7071 const contents = await getFilesRecursively ( 'Code-Study' , 'Code' , props . metastring ) ;
7172 const codePromises = contents . map ( element =>
7273 getRepositoryFileContent ( 'Code-Study' , 'Code' , element )
7374 ) ;
7475 const codeContents = await Promise . all ( codePromises ) ;
7576 setCodes ( codeContents ) ;
76- console . log ( contents . map ( elem => elem . split ( '/' ) . pop ( ) . split ( '.' ) [ 0 ] ) ) ;
77+ // console.log(contents.map(elem => elem.split('/').pop().split('.')[0]));
7778 setNames ( contents . map ( elem => elem . split ( '/' ) . pop ( ) . split ( '.' ) [ 0 ] ) ) ;
7879 }
7980 } catch ( error ) {
You can’t perform that action at this time.
0 commit comments