Browse Source

Fixes for transactionsSaga

develop
Apostolos Fanakis 6 years ago
parent
commit
bd917c6293
  1. 4
      app/src/orbit.js
  2. 13
      app/src/redux/sagas/transactionsSaga.js

4
app/src/orbit.js

@ -59,8 +59,8 @@ async function loadDatabases(identityId, identityPublicKey, identityPrivateKey,
topicsDB = await orbitdb.keyvalue('/orbitdb/' + topicsDB +'/topics'); topicsDB = await orbitdb.keyvalue('/orbitdb/' + topicsDB +'/topics');
postsDB = await orbitdb.keyvalue('/orbitdb/' + postsDB +'/posts'); postsDB = await orbitdb.keyvalue('/orbitdb/' + postsDB +'/posts');
topicsDB.load(); await topicsDB.load();
postsDB.load(); await postsDB.load();
store.dispatch({ store.dispatch({
type: "DATABASES_LOADED", type: "DATABASES_LOADED",

13
app/src/redux/sagas/transactionsSaga.js

@ -10,6 +10,7 @@ function* initTransaction(action) {
.cacheSend(...[action.transactionDescriptor.params]); .cacheSend(...[action.transactionDescriptor.params]);
transactionsHistory[dataKey] = action; transactionsHistory[dataKey] = action;
transactionsHistory[dataKey].state = 'initialized';
} }
function* handleEvent(action) { function* handleEvent(action) {
@ -23,13 +24,11 @@ function* handleEvent(action) {
//Gets orbit //Gets orbit
const orbit = yield select((state) => state.orbit); const orbit = yield select((state) => state.orbit);
//And saves the topic //And saves the topic
/*yield call(orbit.topicsDB.put, ...[action.event.returnValues.topicID, { yield call([orbit.topicsDB, 'put'], [action.event.returnValues.topicID,
subject: transactionsHistory[dataKey].userInputs.topicSubject { subject: transactionsHistory[dataKey].userInputs.topicSubject }]);
}]); yield call([orbit.postsDB, 'put'], [action.event.returnValues.postID,
yield call(orbit.postsDB.put, ...[action.event.returnValues.postID, { {subject: transactionsHistory[dataKey].userInputs.topicSubject,
subject: transactionsHistory[dataKey].userInputs.topicSubject, content: transactionsHistory[dataKey].userInputs.topicMessage }]);
content: transactionsHistory[dataKey].userInputs.topicMessage
}]);*/
transactionsHistory[dataKey].state = 'success'; transactionsHistory[dataKey].state = 'success';
} }

Loading…
Cancel
Save