Browse Source

Add db name to fetchUserDb arguments

develop
Apostolos Fanakis 4 years ago
parent
commit
d436bec16a
  1. 3
      packages/concordia-app/src/components/TopicList/TopicListRow/index.jsx
  2. 4
      packages/concordia-app/src/redux/sagas/peerDbReplicationSaga.js
  3. 5
      packages/concordia-app/src/views/Topic/TopicView/index.jsx

3
packages/concordia-app/src/components/TopicList/TopicListRow/index.jsx

@ -2,7 +2,7 @@ import React, {
memo, useEffect, useMemo, useState, memo, useEffect, useMemo, useState,
} from 'react'; } from 'react';
import { import {
Dimmer, Grid, List, Loader, Placeholder, Dimmer, Grid, List, Placeholder,
} from 'semantic-ui-react'; } from 'semantic-ui-react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
@ -43,6 +43,7 @@ const TopicListRow = (props) => {
dispatch({ dispatch({
type: FETCH_USER_DATABASE, type: FETCH_USER_DATABASE,
orbit, orbit,
dbName: 'topics',
userAddress: topicAuthorAddress, userAddress: topicAuthorAddress,
}); });
} }

4
packages/concordia-app/src/redux/sagas/peerDbReplicationSaga.js

@ -10,9 +10,9 @@ import {
import determineKVAddress from '../../orbit/orbitUtils'; import determineKVAddress from '../../orbit/orbitUtils';
import { FETCH_USER_DATABASE, UPDATE_ORBIT_DATA } from '../actions/peerDbReplicationActions'; import { FETCH_USER_DATABASE, UPDATE_ORBIT_DATA } from '../actions/peerDbReplicationActions';
function* fetchUserDb({ orbit, userAddress }) { function* fetchUserDb({ orbit, userAddress, dbName }) {
const peerDbAddress = yield call(determineKVAddress, { const peerDbAddress = yield call(determineKVAddress, {
orbit, dbName: 'topics', userAddress, orbit, dbName, userAddress,
}); });
yield put(createOrbitDatabase(orbit, { name: peerDbAddress, type: 'keyvalue' })); yield put(createOrbitDatabase(orbit, { name: peerDbAddress, type: 'keyvalue' }));

5
packages/concordia-app/src/views/Topic/TopicView/index.jsx

@ -2,7 +2,7 @@ import React, { useEffect, useState } from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { useDispatch, useSelector } from 'react-redux'; import { useDispatch, useSelector } from 'react-redux';
import { import {
Container, Dimmer, Icon, Loader, Placeholder, Step, Container, Dimmer, Icon, Placeholder, Step,
} from 'semantic-ui-react'; } from 'semantic-ui-react';
import moment from 'moment'; import moment from 'moment';
import { breeze, drizzle } from '../../../redux/store'; import { breeze, drizzle } from '../../../redux/store';
@ -49,7 +49,7 @@ const TopicView = (props) => {
setTopicAuthorAddress(getTopicResults[getTopicCallHash].value[0]); setTopicAuthorAddress(getTopicResults[getTopicCallHash].value[0]);
setTopicAuthor(getTopicResults[getTopicCallHash].value[1]); setTopicAuthor(getTopicResults[getTopicCallHash].value[1]);
setTimestamp(getTopicResults[getTopicCallHash].value[2]); setTimestamp(getTopicResults[getTopicCallHash].value[2]);
setPostIds(getTopicResults[getTopicCallHash].value[3]); setPostIds(getTopicResults[getTopicCallHash].value[3].map((postId) => parseInt(postId, 10)));
const topicFound = topics const topicFound = topics
.find((topic) => topic.id === topicId); .find((topic) => topic.id === topicId);
@ -58,6 +58,7 @@ const TopicView = (props) => {
dispatch({ dispatch({
type: FETCH_USER_DATABASE, type: FETCH_USER_DATABASE,
orbit, orbit,
dbName: 'topics',
userAddress: getTopicResults[getTopicCallHash].value[0], userAddress: getTopicResults[getTopicCallHash].value[0],
}); });
} }

Loading…
Cancel
Save