File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -82,8 +82,20 @@ function changeCatalogMenueFunction(event) {
8282
8383//?: ืืฉืื ืฉื ืืืจืืข ืฉืืจืขื ื ืืช ืืืคืื
8484document . addEventListener ( 'DOMContentLoaded' , ( ) => {
85+ // ืืืืฃ ืึพusername ืึพrepo ืฉืื
86+ const githubUsername = 'shaialt' ;
87+ const githubRepo = 'Moto-Ride' ;
88+
89+ // ืืืืง ืื ืื ืื ื ืึพGitHub Pages ืืคื ื-hostname (ืืคืฉืจ ืืืชืืื ืืคื ืืฆืืจื)
90+ const isGitHubPages = window . location . hostname === `${ githubUsername } .github.io` ;
91+
92+ // ืืืืืจ ืืช ืืกืืก ืื ืชืื ืืคื ืืกืืืื:
93+ // ืื GitHub Pages: /repo-name/
94+ // ืืืจืช (ืืืื ืกืจืืจ ืืงืืื ืื ืกืืืื ืืืจืช): ../
95+ const basePath = isGitHubPages ? `/${ githubRepo } /` : '../' ;
96+
8597 //?: ืืื ืกืช ืืืฆืจืื ืืชืื ื'ืืืกืื ืืงืืืื ืืืคื ืืขืื
86- fetch ( '../ assets/products.json')
98+ fetch ( basePath + ' assets/products.json')
8799 . then ( response => response . json ( ) )
88100 . then ( products => {
89101 // ืืืืงืช ืืืืช ืืืฆืจืื ืืืชืจ
You canโt perform that action at this time.
0 commit comments