From 79b42d6a9b1d62fc6ac7c71dd815196be23742f0 Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Thu, 11 Apr 2019 09:00:43 -0400 Subject: [PATCH] testing --- dist/bundle.js | 10 ++++++++-- package.json | 2 +- src/redux/actions/sync.js | 16 +++++++++++----- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/dist/bundle.js b/dist/bundle.js index f3648ae..be8201c 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -9632,7 +9632,9 @@ function doSetSync(oldHash, newHash, data) { type: ACTIONS.SET_SYNC_STARTED }); + console.log('/sync/set with old_hash: ' + oldHash + ', new_hash: ' + newHash + ', data: ' + data); _lbryio2.default.call('sync', 'set', { old_hash: oldHash, new_hash: newHash, data: data }, 'post').then(function (response) { + console.log(response); if (!response.success) { return dispatch({ type: ACTIONS.SET_SYNC_FAILED, @@ -9645,7 +9647,8 @@ function doSetSync(oldHash, newHash, data) { data: { syncHash: response.hash } }); }).catch(function (error) { - return dispatch({ + console.log(error); + dispatch({ type: ACTIONS.SET_SYNC_FAILED, data: { error: error } }); @@ -9660,7 +9663,9 @@ function doGetSync(password) { }); _lbryRedux.Lbry.sync_hash().then(function (hash) { + console.log('/sync/get with hash: ' + hash + ', password: ' + password); _lbryio2.default.call('sync', 'get', { hash: hash }, 'post').then(function (response) { + console.log(response); var data = { hasWallet: true }; if (response.changed) { var syncHash = response.hash; @@ -9677,7 +9682,8 @@ function doGetSync(password) { } dispatch({ type: ACTIONS.GET_SYNC_COMPLETED, data: data }); - }).catch(function () { + }).catch(function (err) { + console.log(err); // user doesn't have a synced wallet dispatch({ type: ACTIONS.GET_SYNC_COMPLETED, diff --git a/package.json b/package.json index a337122..1d6f4fb 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "reselect": "^3.0.0" }, "peerDependencies": { - "lbry-redux": "lbryio/lbry-redux" + "lbry-redux": "lbryio/lbry-redux#sync" }, "devDependencies": { "babel-core": "^6.26.0", diff --git a/src/redux/actions/sync.js b/src/redux/actions/sync.js index 3ee38bd..525e3a4 100644 --- a/src/redux/actions/sync.js +++ b/src/redux/actions/sync.js @@ -8,8 +8,10 @@ export function doSetSync(oldHash, newHash, data) { type: ACTIONS.SET_SYNC_STARTED, }); + console.log(`/sync/set with old_hash: ${oldHash}, new_hash: ${newHash}, data: ${data}`); Lbryio.call('sync', 'set', { old_hash: oldHash, new_hash: newHash, data }, 'post') .then(response => { + console.log(response); if (!response.success) { return dispatch({ type: ACTIONS.SET_SYNC_FAILED, @@ -22,12 +24,13 @@ export function doSetSync(oldHash, newHash, data) { data: { syncHash: response.hash }, }); }) - .catch(error => + .catch(error => { + console.log(error); dispatch({ type: ACTIONS.SET_SYNC_FAILED, data: { error }, - }) - ); + }); + }); }; } @@ -38,8 +41,10 @@ export function doGetSync(password) { }); Lbry.sync_hash().then(hash => { + console.log(`/sync/get with hash: ${hash}, password: ${password}`); Lbryio.call('sync', 'get', { hash }, 'post') .then(response => { + console.log(response); const data = { hasWallet: true }; if (response.changed) { const syncHash = response.hash; @@ -56,7 +61,8 @@ export function doGetSync(password) { dispatch({ type: ACTIONS.GET_SYNC_COMPLETED, data }); }) - .catch(() => { + .catch(err => { + console.log(err); // user doesn't have a synced wallet dispatch({ type: ACTIONS.GET_SYNC_COMPLETED, @@ -66,7 +72,7 @@ export function doGetSync(password) { // call sync_apply to get data to sync // first time sync. use any string for old hash Lbry.sync_apply({ password }).then(({ hash: walletHash, data }) => - dispatch(doSetSync('null', walletHash, data)) + dispatch(doSetSync(null, walletHash, data)) ); }); });