mirror of
https://github.com/Tomato6966/investment-portfolio-simulator.git
synced 2025-04-12 08:48:42 +02:00
add note about proxy server
This commit is contained in:
parent
464e2dc756
commit
434d07b421
1 changed files with 5 additions and 2 deletions
|
@ -37,6 +37,9 @@ interface YahooChartResult {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// this is only needed when hosted staticly without a proxy server or smt
|
||||||
|
// TODO change it to use the proxy server
|
||||||
const isDev = import.meta.env.DEV;
|
const isDev = import.meta.env.DEV;
|
||||||
const CORS_PROXY = 'https://corsproxy.io/?url=';
|
const CORS_PROXY = 'https://corsproxy.io/?url=';
|
||||||
const YAHOO_API = 'https://query1.finance.yahoo.com';
|
const YAHOO_API = 'https://query1.finance.yahoo.com';
|
||||||
|
@ -50,7 +53,7 @@ export const searchAssets = async (query: string): Promise<Asset[]> => {
|
||||||
type: 'equity,etf',
|
type: 'equity,etf',
|
||||||
});
|
});
|
||||||
|
|
||||||
const url = `${API_BASE}/v1/finance/lookup?${params}`;
|
const url = `${API_BASE}/v1/finance/lookup${isDev ? encodeURIComponent(`?${params}`) : `?${params}`}`;
|
||||||
const response = await fetch(url);
|
const response = await fetch(url);
|
||||||
if (!response.ok) throw new Error('Network response was not ok');
|
if (!response.ok) throw new Error('Network response was not ok');
|
||||||
|
|
||||||
|
@ -96,7 +99,7 @@ export const getHistoricalData = async (symbol: string, startDate: string, endDa
|
||||||
interval: '1d',
|
interval: '1d',
|
||||||
});
|
});
|
||||||
|
|
||||||
const url = `${API_BASE}/v8/finance/chart/${symbol}?${params}`;
|
const url = `${API_BASE}/v8/finance/chart/${symbol}${isDev ? encodeURIComponent(`?${params}`) : `?${params}`}`;
|
||||||
const response = await fetch(url);
|
const response = await fetch(url);
|
||||||
if (!response.ok) throw new Error('Network response was not ok');
|
if (!response.ok) throw new Error('Network response was not ok');
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue