testing
This commit is contained in:
parent
db463188a8
commit
79b42d6a9b
3 changed files with 20 additions and 8 deletions
10
dist/bundle.js
vendored
10
dist/bundle.js
vendored
|
@ -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,
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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))
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue