Skip to content

Commit

Permalink
dont overwrite an access token with nothing
Browse files Browse the repository at this point in the history
  • Loading branch information
chee committed Dec 30, 2020
1 parent f9b396c commit 70bff01
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions run
Expand Up @@ -16,10 +16,19 @@ if [ "$code" == "unauthorized.bad_access_token.expired" ]; then
echo $response
access_token=$(echo $response | jq -r .access_token)
refresh_token=$(echo $response | jq -r .refresh_token)
echo "access_token=\"$access_token\"" >> .env
echo "refresh_token=\"$refresh_token\"" >> .env
if [ -z "$access_token" ] || [ -z "$refresh_token" ]; then
exit 2
else
echo "access_token=\"$access_token\"" >> .env
echo "refresh_token=\"$refresh_token\"" >> .env
exit 3
fi
fi
current_pot_value=$(echo -n $pots | jq ".pots[] | select(.id==\"$pot_id\") | .balance")
if [ -z "$current_pot_value" ]; then
echo "DIDNT GET A CURRENT POT VALUE"
exit 2
fi
echo "there's currently $current_pot_value pennies in the amex pot"
current_balance=$(($(node get-balance.js) * 100))
echo "the amex balance is $current_balance pennies"
Expand Down

0 comments on commit 70bff01

Please sign in to comment.