Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
firstName: 'Fred',
lastName: 'Flintstone'
}
}).then(r => {
// $ExpectError
(r.status: string);
});
class AxiosExtended extends axios.Axios {
specialPut(...args) {
return super.put(...args);
}
}
const extended = new AxiosExtended();
axios.all([
extended.specialPut('foo')
.then((r) => {
// $ExpectError
(r.statusText: number)
}),
Promise.reject(12)
]).then(([a, b]) => {
// $ExpectError
(a: string);
})
_fetchData = () => {
axios.all([
axios.get('/api/v1/database'),
axios.get('/api/v1/Omniboard.Settings'),
axios.get('/api/v1/Version')
]).then(axios.spread((dbResponse, settingsResponse, versionResponse) => {
if (dbResponse && dbResponse.data && dbResponse.data.name) {
this.setState({
dbName: dbResponse.data.name
});
}
if (versionResponse && versionResponse.data && versionResponse.data.version) {
this.setState({
appVersion: `v${versionResponse.data.version}`
});
}
const runner = () => axios.all([
codeforces(),
hackerearth(),
hackerrank(),
topcoder(),
leetcode(),
codechef(),
atcoder(),
csacademy(),
coj(),
kaggle(),
])
.then((contestsByPlatform) => {
const contests = flat(contestsByPlatform.filter(it => Array.isArray(it)));
const curTime = getCurrentTimeInSeconds();
handleSubmitToFetchAPI = () => {
const { stockTicker, fromDate, toDate } = this.state;
const APIkey = process.env.REACT_APP_QUANDL_API_KEY;
if (stockTicker !== "" && fromDate !== "" && toDate !== "") {
const url_stockPrice = `https://www.quandl.com/api/v3/datasets/WIKI/${stockTicker}.json?start_date=${fromDate}&end_date=${toDate}&column_index=4&api_key=${APIkey}`;
const url_stockFundamentalsValuationRatios = `https://financialmodelingprep.com/api/financial-ratios/${stockTicker}?datatype=json`;
axios
.all([
axios.get(url_stockPrice),
axios.get(url_stockFundamentalsValuationRatios)
])
.then(
axios.spread((stockPriceData, stockFundamentalsData) => {
const receivedStockClosingData = stockPriceData.data.dataset.data;
const closingPriceDate = receivedStockClosingData.map(i => i[0]);
const closingPrice = receivedStockClosingData.map(i => i[1]);
this.setState({
xAxisData: closingPriceDate,
yAxisData_StockClosingPrice: closingPrice,
ySeriesDataForValuationRatios: getYSeriesDataValuationMatrix(
stockFundamentalsData.data.financialRatios
),
xSeriesDataForValuationRatios: Object.keys(
]).then(axios.spread((res, res1) => {
axios.all([
seafileAPI.getFileContent(res.data),
seafileAPI.getFileContent(res1.data)
]).then(axios.spread((content1, content2) => {
this.setDiffContent(content1.data, content2.data);
}));
}));
} else {
all(promises: any) {
return axios.all(promises);
}
getData: params =>
axios
.all([
getExtent({ ...params, forestType: '' }),
getExtent({ ...params }),
getExtent({ ...params, forestType: 'plantations' })
])
.then(
axios.spread((gadm28Response, iflResponse, plantationsResponse) => {
const gadmExtent = gadm28Response.data && gadm28Response.data.data;
const iflExtent = iflResponse.data && iflResponse.data.data;
let totalArea = 0;
let totalExtent = 0;
let extent = 0;
let plantations = 0;
let data = {};
const plantationsData =
plantationsResponse.data && plantationsResponse.data.data;
const tripSelectors = `avg(trip_duration)/60 as avg_duration_minutes, sum(trip_distance) * 0.000621371 as total_miles, avg(trip_distance) * 0.000621371 as avg_miles, count(trip_id) as total_trips`;
const tripFilters = `trip_distance * 0.000621371 >= 0.1 AND trip_distance * 0.000621371 < 500 AND trip_duration < 86400`;
const dataByModeQuery = `SELECT vehicle_type, ${tripSelectors} WHERE start_time between ${dateQuery} AND ${tripFilters} GROUP BY vehicle_type`;
const allModesQuery = `SELECT ${tripSelectors} WHERE start_time between ${dateQuery} AND ${tripFilters}`;
const deviceCountScooterQuery = `SELECT DISTINCT device_id WHERE start_time between ${dateQuery} AND vehicle_type = 'scooter' LIMIT 1000000000`;
const deviceCountBicycleQuery = `SELECT DISTINCT device_id WHERE start_time between ${dateQuery} AND vehicle_type = 'bicycle' LIMIT 1000000000`;
const threeOneOneQuery = `SELECT count(sr_type_code) as count WHERE sr_created_date between ${dateQuery} AND sr_type_code == "DOCKMOBI"`;
const dataByModeUrl = `https://data.austintexas.gov/resource/${resourceId}.json?$query=${dataByModeQuery}`;
const allModesUrl = `https://data.austintexas.gov/resource/${resourceId}.json?$query=${allModesQuery}`;
const deviceCountScooterUrl = `https://data.austintexas.gov/resource/${resourceId}.json?$query=${deviceCountScooterQuery}`;
const deviceCountBicycleUrl = `https://data.austintexas.gov/resource/${resourceId}.json?$query=${deviceCountBicycleQuery}`;
const threeOneOneUrl = `https://data.austintexas.gov/resource/${resourceId311}.json?$query=${threeOneOneQuery}`;
axios
.all([
axios.get(dataByModeUrl),
axios.get(allModesUrl),
axios.get(deviceCountScooterUrl),
axios.get(deviceCountBicycleUrl),
axios.get(threeOneOneUrl)
])
.then(res => {
const dataByModeResponse = res[0].data;
const allDataResponse = res[1].data;
const deviceScooterDataResponse = res[2].data;
const deviceBicycleDataResponse = res[3].data;
const threeOneOneResponse = res[4].data;
let bicycleData = _.filter(
dataByModeResponse,
export const searchMediaServers = async (): Promise<
MediaServerUdpBroadcast[]
> => {
const embySearch = axiosInstance.get(
`${domain}server/search?serverType=0`
);
const jellyfinSearch = axiosInstance.get(
`${domain}server/search?serverType=1`
);
return axios.all([embySearch, jellyfinSearch]).then(
axios.spread((...responses) => {
const servers: MediaServerUdpBroadcast[] = [];
responses.forEach((response) => {
if (response.status === 200) {
servers.push(response.data);
}
});
return servers;
})
);
};