fixes for flow and linter
This commit is contained in:
parent
6ae732b77b
commit
bcb1197dfb
5 changed files with 17 additions and 21 deletions
|
@ -39,9 +39,11 @@ type Props = {
|
||||||
};
|
};
|
||||||
|
|
||||||
type Delta = {
|
type Delta = {
|
||||||
dkey: string,
|
dkey?: string,
|
||||||
value: string,
|
value?: string,
|
||||||
tab: string
|
tab?: string,
|
||||||
|
currency?: string,
|
||||||
|
fiatType?: string
|
||||||
};
|
};
|
||||||
|
|
||||||
function TxoList(props: Props) {
|
function TxoList(props: Props) {
|
||||||
|
@ -197,10 +199,17 @@ function TxoList(props: Props) {
|
||||||
function updateUrl(delta: Delta) {
|
function updateUrl(delta: Delta) {
|
||||||
const newUrlParams = new URLSearchParams();
|
const newUrlParams = new URLSearchParams();
|
||||||
|
|
||||||
|
// fix for flow, maybe there is a better way?
|
||||||
|
if (!delta.value) {
|
||||||
|
delta.value = '';
|
||||||
|
}
|
||||||
|
|
||||||
const existingFiatType = newUrlParams.get('fiatType') || 'incoming';
|
const existingFiatType = newUrlParams.get('fiatType') || 'incoming';
|
||||||
|
|
||||||
|
if (delta.tab) {
|
||||||
// set tab name to account for wallet page tab
|
// set tab name to account for wallet page tab
|
||||||
newUrlParams.set('tab', delta.tab);
|
newUrlParams.set('tab', delta.tab);
|
||||||
|
}
|
||||||
|
|
||||||
// only update currency if it's being changed
|
// only update currency if it's being changed
|
||||||
if (delta.currency) {
|
if (delta.currency) {
|
||||||
|
|
|
@ -10,7 +10,6 @@ import Card from 'component/common/card';
|
||||||
import LbcSymbol from 'component/common/lbc-symbol';
|
import LbcSymbol from 'component/common/lbc-symbol';
|
||||||
import I18nMessage from 'component/i18nMessage';
|
import I18nMessage from 'component/i18nMessage';
|
||||||
import { formatNumberWithCommas } from 'util/number';
|
import { formatNumberWithCommas } from 'util/number';
|
||||||
import Icon from 'component/common/icon';
|
|
||||||
import WalletFiatBalance from 'component/walletFiatBalance';
|
import WalletFiatBalance from 'component/walletFiatBalance';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
// @flow
|
// @flow
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import Button from 'component/button';
|
import Button from 'component/button';
|
||||||
import Card from 'component/common/card';
|
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
|
|
|
@ -7,16 +7,10 @@ import Card from 'component/common/card';
|
||||||
import Icon from 'component/common/icon';
|
import Icon from 'component/common/icon';
|
||||||
import I18nMessage from 'component/i18nMessage';
|
import I18nMessage from 'component/i18nMessage';
|
||||||
import { Lbryio } from 'lbryinc';
|
import { Lbryio } from 'lbryinc';
|
||||||
import { STRIPE_PUBLIC_KEY } from 'config';
|
import { getStripeEnvironment } from 'util/stripe';
|
||||||
|
let stripeEnvironment = getStripeEnvironment();
|
||||||
|
|
||||||
let stripeEnvironment = 'test';
|
const WalletBalance = () => {
|
||||||
// if the key contains pk_live it's a live key
|
|
||||||
// update the environment for the calls to the backend to indicate which environment to hit
|
|
||||||
if (STRIPE_PUBLIC_KEY.indexOf('pk_live') > -1) {
|
|
||||||
stripeEnvironment = 'live';
|
|
||||||
}
|
|
||||||
|
|
||||||
const WalletBalance = (props: Props) => {
|
|
||||||
const [accountStatusResponse, setAccountStatusResponse] = React.useState();
|
const [accountStatusResponse, setAccountStatusResponse] = React.useState();
|
||||||
|
|
||||||
function getAccountStatus() {
|
function getAccountStatus() {
|
||||||
|
@ -40,7 +34,6 @@ const WalletBalance = (props: Props) => {
|
||||||
const response = await getAccountStatus();
|
const response = await getAccountStatus();
|
||||||
|
|
||||||
setAccountStatusResponse(response);
|
setAccountStatusResponse(response);
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,9 +7,7 @@ import Page from 'component/page';
|
||||||
import * as PAGES from 'constants/pages';
|
import * as PAGES from 'constants/pages';
|
||||||
import Spinner from 'component/spinner';
|
import Spinner from 'component/spinner';
|
||||||
import YrblWalletEmpty from 'component/yrblWalletEmpty';
|
import YrblWalletEmpty from 'component/yrblWalletEmpty';
|
||||||
import { Lbryio } from 'lbryinc';
|
|
||||||
import { Tabs, TabList, Tab, TabPanels, TabPanel } from 'component/common/tabs';
|
import { Tabs, TabList, Tab, TabPanels, TabPanel } from 'component/common/tabs';
|
||||||
import { getStripeEnvironment } from 'util/stripe';
|
|
||||||
|
|
||||||
const TAB_QUERY = 'tab';
|
const TAB_QUERY = 'tab';
|
||||||
|
|
||||||
|
@ -19,8 +17,6 @@ const TABS = {
|
||||||
PAYMENT_HISTORY: 'fiat-payment-history',
|
PAYMENT_HISTORY: 'fiat-payment-history',
|
||||||
};
|
};
|
||||||
|
|
||||||
let stripeEnvironment = getStripeEnvironment();
|
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
history: { action: string, push: (string) => void, replace: (string) => void },
|
history: { action: string, push: (string) => void, replace: (string) => void },
|
||||||
location: { search: string, pathname: string },
|
location: { search: string, pathname: string },
|
||||||
|
|
Loading…
Add table
Reference in a new issue