Skip to content

Commit

Permalink
Merge pull request #189 from hunterjm/develop
Browse files Browse the repository at this point in the history
ensure auctionInfo is an empty array
  • Loading branch information
hunterjm authored Jun 3, 2017
2 parents d4d49b3 + ffca0c3 commit 3b0eace
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
10 changes: 10 additions & 0 deletions app/actions/bid.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ export function snipe(player, settings) {
let binResponse;
try {
binResponse = await api.search(binFilter);
// auctionInfo is not always an empty array
binResponse.auctionInfo = binResponse.auctionInfo || [];
} catch (e) {
dispatch(addMessage('error', `Error searching for BIN on ${player.name}`, e));
binResponse = { auctionInfo: [] };
Expand Down Expand Up @@ -160,6 +162,8 @@ export function placeBid(player, settings) {
let resultsWithinTimeframe = [];
try {
const bidResponse = await api.search(bidFilter);
// auctionInfo is not always an empty array
bidResponse.auctionInfo = bidResponse.auctionInfo || [];
searchResults = bidResponse.auctionInfo.length;
resultsWithinTimeframe = _.filter(
bidResponse.auctionInfo,
Expand Down Expand Up @@ -403,6 +407,8 @@ export function continueTracking(settings) {
let statuses;
try {
statuses = await api.getStatus(tradeIds);
// auctionInfo is not always an empty array
statuses.auctionInfo = statuses.auctionInfo || [];
dispatch(setCredits(statuses.credits));
} catch (e) {
dispatch(addMessage('error', `Error getting trade statuses: ${JSON.stringify(tradeIds)}`, e));
Expand Down Expand Up @@ -563,6 +569,8 @@ export function getTradepile(email) {
dispatch(addMessage('log', 'Updating tradepile...'));
const api = getApi(email);
const response = await api.getTradepile();
// auctionInfo is not always an empty array
response.auctionInfo = response.auctionInfo || [];
dispatch(setCredits(response.credits));
dispatch({ type: types.SET_TRADEPILE, tradepile: response.auctionInfo });
};
Expand All @@ -573,6 +581,8 @@ export function getWatchlist(email) {
dispatch(addMessage('log', 'Updating watchlist...'));
const api = getApi(email);
const response = await api.getWatchlist();
// auctionInfo is not always an empty array
response.auctionInfo = response.auctionInfo || [];
dispatch(setCredits(response.credits));
dispatch(setWatchlist(response.auctionInfo));
};
Expand Down
2 changes: 1 addition & 1 deletion app/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "fifa-autobuyer",
"productName": "FIFA Autobuyer",
"version": "0.4.4",
"version": "0.4.5",
"description": "Autobuyer for FIFA 17 Ultimate Team",
"main": "./main.js",
"author": {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "fifa-autobuyer",
"productName": "FIFA Autobuyer",
"version": "0.4.4",
"version": "0.4.5",
"description": "Autobuyer for FIFA 17 Ultimate Team",
"main": "main.js",
"scripts": {
Expand Down

0 comments on commit 3b0eace

Please sign in to comment.