fix wallet balance subscribe when the api call fails
This commit is contained in:
parent
8086ccdc01
commit
3779c05888
2 changed files with 37 additions and 19 deletions
14
dist/bundle.es.js
vendored
14
dist/bundle.es.js
vendored
|
@ -15,6 +15,7 @@ const CHANNEL_NEW = 'new';
|
||||||
const PAGE_SIZE = 20;
|
const PAGE_SIZE = 20;
|
||||||
|
|
||||||
var claim = /*#__PURE__*/Object.freeze({
|
var claim = /*#__PURE__*/Object.freeze({
|
||||||
|
__proto__: null,
|
||||||
MINIMUM_PUBLISH_BID: MINIMUM_PUBLISH_BID,
|
MINIMUM_PUBLISH_BID: MINIMUM_PUBLISH_BID,
|
||||||
CHANNEL_ANONYMOUS: CHANNEL_ANONYMOUS,
|
CHANNEL_ANONYMOUS: CHANNEL_ANONYMOUS,
|
||||||
CHANNEL_NEW: CHANNEL_NEW,
|
CHANNEL_NEW: CHANNEL_NEW,
|
||||||
|
@ -274,6 +275,7 @@ const TOGGLE_BLOCK_CHANNEL = 'TOGGLE_BLOCK_CHANNEL';
|
||||||
const USER_STATE_POPULATE = 'USER_STATE_POPULATE';
|
const USER_STATE_POPULATE = 'USER_STATE_POPULATE';
|
||||||
|
|
||||||
var action_types = /*#__PURE__*/Object.freeze({
|
var action_types = /*#__PURE__*/Object.freeze({
|
||||||
|
__proto__: null,
|
||||||
WINDOW_FOCUSED: WINDOW_FOCUSED,
|
WINDOW_FOCUSED: WINDOW_FOCUSED,
|
||||||
DAEMON_READY: DAEMON_READY,
|
DAEMON_READY: DAEMON_READY,
|
||||||
DAEMON_VERSION_MATCH: DAEMON_VERSION_MATCH,
|
DAEMON_VERSION_MATCH: DAEMON_VERSION_MATCH,
|
||||||
|
@ -516,6 +518,7 @@ const OTHER = 'other';
|
||||||
const COPYRIGHT = 'copyright';
|
const COPYRIGHT = 'copyright';
|
||||||
|
|
||||||
var licenses = /*#__PURE__*/Object.freeze({
|
var licenses = /*#__PURE__*/Object.freeze({
|
||||||
|
__proto__: null,
|
||||||
CC_LICENSES: CC_LICENSES,
|
CC_LICENSES: CC_LICENSES,
|
||||||
NONE: NONE,
|
NONE: NONE,
|
||||||
PUBLIC_DOMAIN: PUBLIC_DOMAIN,
|
PUBLIC_DOMAIN: PUBLIC_DOMAIN,
|
||||||
|
@ -546,6 +549,7 @@ const HISTORY = 'user_history';
|
||||||
const WALLET = 'wallet';
|
const WALLET = 'wallet';
|
||||||
|
|
||||||
var pages = /*#__PURE__*/Object.freeze({
|
var pages = /*#__PURE__*/Object.freeze({
|
||||||
|
__proto__: null,
|
||||||
AUTH: AUTH,
|
AUTH: AUTH,
|
||||||
BACKUP: BACKUP,
|
BACKUP: BACKUP,
|
||||||
CHANNEL: CHANNEL,
|
CHANNEL: CHANNEL,
|
||||||
|
@ -595,6 +599,7 @@ const RECEIVE_INTERESTS_NOTIFICATIONS = 'receiveInterestsNotifications';
|
||||||
const RECEIVE_CREATOR_NOTIFICATIONS = 'receiveCreatorNotifications';
|
const RECEIVE_CREATOR_NOTIFICATIONS = 'receiveCreatorNotifications';
|
||||||
|
|
||||||
var settings = /*#__PURE__*/Object.freeze({
|
var settings = /*#__PURE__*/Object.freeze({
|
||||||
|
__proto__: null,
|
||||||
CREDIT_REQUIRED_ACKNOWLEDGED: CREDIT_REQUIRED_ACKNOWLEDGED,
|
CREDIT_REQUIRED_ACKNOWLEDGED: CREDIT_REQUIRED_ACKNOWLEDGED,
|
||||||
NEW_USER_ACKNOWLEDGED: NEW_USER_ACKNOWLEDGED,
|
NEW_USER_ACKNOWLEDGED: NEW_USER_ACKNOWLEDGED,
|
||||||
EMAIL_COLLECTION_ACKNOWLEDGED: EMAIL_COLLECTION_ACKNOWLEDGED,
|
EMAIL_COLLECTION_ACKNOWLEDGED: EMAIL_COLLECTION_ACKNOWLEDGED,
|
||||||
|
@ -622,6 +627,7 @@ const TITLE = 'title';
|
||||||
const FILENAME = 'filename';
|
const FILENAME = 'filename';
|
||||||
|
|
||||||
var sort_options = /*#__PURE__*/Object.freeze({
|
var sort_options = /*#__PURE__*/Object.freeze({
|
||||||
|
__proto__: null,
|
||||||
DATE_NEW: DATE_NEW,
|
DATE_NEW: DATE_NEW,
|
||||||
DATE_OLD: DATE_OLD,
|
DATE_OLD: DATE_OLD,
|
||||||
TITLE: TITLE,
|
TITLE: TITLE,
|
||||||
|
@ -635,6 +641,7 @@ const COMPLETE = 'complete';
|
||||||
const MANUAL = 'manual';
|
const MANUAL = 'manual';
|
||||||
|
|
||||||
var thumbnail_upload_statuses = /*#__PURE__*/Object.freeze({
|
var thumbnail_upload_statuses = /*#__PURE__*/Object.freeze({
|
||||||
|
__proto__: null,
|
||||||
API_DOWN: API_DOWN,
|
API_DOWN: API_DOWN,
|
||||||
READY: READY,
|
READY: READY,
|
||||||
IN_PROGRESS: IN_PROGRESS,
|
IN_PROGRESS: IN_PROGRESS,
|
||||||
|
@ -654,6 +661,7 @@ const UPDATE = 'update';
|
||||||
const ABANDON = 'abandon';
|
const ABANDON = 'abandon';
|
||||||
|
|
||||||
var transaction_types = /*#__PURE__*/Object.freeze({
|
var transaction_types = /*#__PURE__*/Object.freeze({
|
||||||
|
__proto__: null,
|
||||||
ALL: ALL,
|
ALL: ALL,
|
||||||
SPEND: SPEND,
|
SPEND: SPEND,
|
||||||
RECEIVE: RECEIVE,
|
RECEIVE: RECEIVE,
|
||||||
|
@ -670,6 +678,7 @@ const PAGE_SIZE$1 = 50;
|
||||||
const LATEST_PAGE_SIZE = 20;
|
const LATEST_PAGE_SIZE = 20;
|
||||||
|
|
||||||
var transaction_list = /*#__PURE__*/Object.freeze({
|
var transaction_list = /*#__PURE__*/Object.freeze({
|
||||||
|
__proto__: null,
|
||||||
PAGE_SIZE: PAGE_SIZE$1,
|
PAGE_SIZE: PAGE_SIZE$1,
|
||||||
LATEST_PAGE_SIZE: LATEST_PAGE_SIZE
|
LATEST_PAGE_SIZE: LATEST_PAGE_SIZE
|
||||||
});
|
});
|
||||||
|
@ -678,6 +687,7 @@ const SPEECH_STATUS = 'https://spee.ch/api/config/site/publishing';
|
||||||
const SPEECH_PUBLISH = 'https://spee.ch/api/claim/publish';
|
const SPEECH_PUBLISH = 'https://spee.ch/api/claim/publish';
|
||||||
|
|
||||||
var speech_urls = /*#__PURE__*/Object.freeze({
|
var speech_urls = /*#__PURE__*/Object.freeze({
|
||||||
|
__proto__: null,
|
||||||
SPEECH_STATUS: SPEECH_STATUS,
|
SPEECH_STATUS: SPEECH_STATUS,
|
||||||
SPEECH_PUBLISH: SPEECH_PUBLISH
|
SPEECH_PUBLISH: SPEECH_PUBLISH
|
||||||
});
|
});
|
||||||
|
@ -723,6 +733,7 @@ const WALLET_DIR = 'wallet_dir';
|
||||||
const WALLETS = 'wallets';
|
const WALLETS = 'wallets';
|
||||||
|
|
||||||
var daemon_settings = /*#__PURE__*/Object.freeze({
|
var daemon_settings = /*#__PURE__*/Object.freeze({
|
||||||
|
__proto__: null,
|
||||||
ANNOUNCE_HEAD_AND_SD_ONLY: ANNOUNCE_HEAD_AND_SD_ONLY,
|
ANNOUNCE_HEAD_AND_SD_ONLY: ANNOUNCE_HEAD_AND_SD_ONLY,
|
||||||
API: API,
|
API: API,
|
||||||
BLOB_DOWNLOAD_TIMEOUT: BLOB_DOWNLOAD_TIMEOUT,
|
BLOB_DOWNLOAD_TIMEOUT: BLOB_DOWNLOAD_TIMEOUT,
|
||||||
|
@ -776,6 +787,7 @@ var daemon_settings = /*#__PURE__*/Object.freeze({
|
||||||
const WALLET_SERVERS = LBRYUM_SERVERS;
|
const WALLET_SERVERS = LBRYUM_SERVERS;
|
||||||
|
|
||||||
var shared_preferences = /*#__PURE__*/Object.freeze({
|
var shared_preferences = /*#__PURE__*/Object.freeze({
|
||||||
|
__proto__: null,
|
||||||
WALLET_SERVERS: WALLET_SERVERS
|
WALLET_SERVERS: WALLET_SERVERS
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -2352,6 +2364,8 @@ function doUpdateBalance() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}).catch(() => {
|
||||||
|
walletBalancePromise = null;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,27 +13,31 @@ export function doUpdateBalance() {
|
||||||
} = getState();
|
} = getState();
|
||||||
|
|
||||||
if (walletBalancePromise === null) {
|
if (walletBalancePromise === null) {
|
||||||
walletBalancePromise = Lbry.wallet_balance().then(response => {
|
walletBalancePromise = Lbry.wallet_balance()
|
||||||
walletBalancePromise = null;
|
.then(response => {
|
||||||
|
walletBalancePromise = null;
|
||||||
|
|
||||||
const { available, reserved, reserved_subtotals, total } = response;
|
const { available, reserved, reserved_subtotals, total } = response;
|
||||||
const { claims, supports, tips } = reserved_subtotals;
|
const { claims, supports, tips } = reserved_subtotals;
|
||||||
const totalFloat = parseFloat(total);
|
const totalFloat = parseFloat(total);
|
||||||
|
|
||||||
if (totalInStore !== totalFloat) {
|
if (totalInStore !== totalFloat) {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: ACTIONS.UPDATE_BALANCE,
|
type: ACTIONS.UPDATE_BALANCE,
|
||||||
data: {
|
data: {
|
||||||
totalBalance: totalFloat,
|
totalBalance: totalFloat,
|
||||||
balance: parseFloat(available),
|
balance: parseFloat(available),
|
||||||
reservedBalance: parseFloat(reserved),
|
reservedBalance: parseFloat(reserved),
|
||||||
claimsBalance: parseFloat(claims),
|
claimsBalance: parseFloat(claims),
|
||||||
supportsBalance: parseFloat(supports),
|
supportsBalance: parseFloat(supports),
|
||||||
tipsBalance: parseFloat(tips),
|
tipsBalance: parseFloat(tips),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
|
.catch(() => {
|
||||||
|
walletBalancePromise = null;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return walletBalancePromise;
|
return walletBalancePromise;
|
||||||
|
|
Loading…
Reference in a new issue