Skip to content

Commit

Permalink
Merge pull request #1027 from glific/bug/bsp-balance
Browse files Browse the repository at this point in the history
Minor fixes
  • Loading branch information
mdshamoon authored Feb 18, 2021
2 parents 8e2e23d + 52681fd commit 7d7a396
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/containers/WalletBalance/WalletBalance.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ export interface WalletBalanceProps {
export const WalletBalance: React.FC<WalletBalanceProps> = ({ fullOpen }) => {
const variables = { organizationId: getUserSession('organizationId') };
const [displayBalance, setDisplayBalance] = useState<any>(null);
const [isBalanceNull, setIsBalanceNull] = useState<any>(false);

// get gupshup balance
const { data: balanceData, loading, error, subscribeToMore } = useQuery(BSPBALANCE, {
Expand All @@ -38,8 +37,6 @@ export const WalletBalance: React.FC<WalletBalanceProps> = ({ fullOpen }) => {
const updateBalanceValue = (balance: any) => {
if (balance && balance !== null) {
setDisplayBalance(balance);
} else if (balance === null) {
setIsBalanceNull(true);
}
};

Expand Down Expand Up @@ -77,7 +74,7 @@ export const WalletBalance: React.FC<WalletBalanceProps> = ({ fullOpen }) => {
}

const errorBody = () => {
if (isBalanceNull || displayBalance === null) {
if (displayBalance === null && !error) {
return nullBalance();
}
return (
Expand Down

0 comments on commit 7d7a396

Please sign in to comment.