File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change 44 */
55class TatakaiAnimeAPI {
66 static BASE_URL = 'https://aniwatch-api-taupe-eight.vercel.app/api/v2/hianime' ;
7+ static LOCAL_PROXY = 'http://localhost:3001/api' ;
78
89 /**
910 * Generic fetch wrapper for API calls
1011 */
1112 static async fetchAPI ( endpoint , options = { } ) {
1213 try {
13- const url = `${ this . BASE_URL } ${ endpoint } ` ;
14+ let url = `${ this . BASE_URL } ${ endpoint } ` ;
15+
16+ // In development/browser environment, use local proxy for CORS
17+ // In actual webOS environment, direct calls should work fine
18+ if ( typeof window !== 'undefined' &&
19+ ( window . location . hostname === 'localhost' || window . location . hostname === '127.0.0.1' ) ) {
20+ url = `${ this . LOCAL_PROXY } ${ endpoint } ` ;
21+ }
22+
1423 console . log ( 'Fetching:' , url ) ;
1524
1625 const response = await fetch ( url , {
26+ mode : 'cors' ,
1727 headers : {
1828 'Accept' : 'application/json' ,
1929 'User-Agent' : 'Mozilla/5.0 (Web0S; Linux; SmartTV) Tatakai/1.0.0' ,
You can’t perform that action at this time.
0 commit comments