fixes for flow and linter

This commit is contained in:
Anthony 2021-08-19 23:20:01 +02:00
parent 6ae732b77b
commit bcb1197dfb
No known key found for this signature in database
GPG key ID: C386D3C93D50E356
5 changed files with 17 additions and 21 deletions

View file

@ -39,9 +39,11 @@ type Props = {
};
type Delta = {
dkey: string,
value: string,
tab: string
dkey?: string,
value?: string,
tab?: string,
currency?: string,
fiatType?: string
};
function TxoList(props: Props) {
@ -197,10 +199,17 @@ function TxoList(props: Props) {
function updateUrl(delta: Delta) {
const newUrlParams = new URLSearchParams();
// fix for flow, maybe there is a better way?
if (!delta.value) {
delta.value = '';
}
const existingFiatType = newUrlParams.get('fiatType') || 'incoming';
// set tab name to account for wallet page tab
newUrlParams.set('tab', delta.tab);
if (delta.tab) {
// set tab name to account for wallet page tab
newUrlParams.set('tab', delta.tab);
}
// only update currency if it's being changed
if (delta.currency) {

View file

@ -10,7 +10,6 @@ import Card from 'component/common/card';
import LbcSymbol from 'component/common/lbc-symbol';
import I18nMessage from 'component/i18nMessage';
import { formatNumberWithCommas } from 'util/number';
import Icon from 'component/common/icon';
import WalletFiatBalance from 'component/walletFiatBalance';
type Props = {

View file

@ -1,7 +1,6 @@
// @flow
import React from 'react';
import Button from 'component/button';
import Card from 'component/common/card';
import moment from 'moment';
type Props = {

View file

@ -7,16 +7,10 @@ import Card from 'component/common/card';
import Icon from 'component/common/icon';
import I18nMessage from 'component/i18nMessage';
import { Lbryio } from 'lbryinc';
import { STRIPE_PUBLIC_KEY } from 'config';
import { getStripeEnvironment } from 'util/stripe';
let stripeEnvironment = getStripeEnvironment();
let stripeEnvironment = 'test';
// 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 WalletBalance = () => {
const [accountStatusResponse, setAccountStatusResponse] = React.useState();
function getAccountStatus() {
@ -40,7 +34,6 @@ const WalletBalance = (props: Props) => {
const response = await getAccountStatus();
setAccountStatusResponse(response);
} catch (err) {
console.log(err);
}

View file

@ -7,9 +7,7 @@ import Page from 'component/page';
import * as PAGES from 'constants/pages';
import Spinner from 'component/spinner';
import YrblWalletEmpty from 'component/yrblWalletEmpty';
import { Lbryio } from 'lbryinc';
import { Tabs, TabList, Tab, TabPanels, TabPanel } from 'component/common/tabs';
import { getStripeEnvironment } from 'util/stripe';
const TAB_QUERY = 'tab';
@ -19,8 +17,6 @@ const TABS = {
PAYMENT_HISTORY: 'fiat-payment-history',
};
let stripeEnvironment = getStripeEnvironment();
type Props = {
history: { action: string, push: (string) => void, replace: (string) => void },
location: { search: string, pathname: string },