the problem of synchronizing the two commentServer of the application was solved
This commit is contained in:
parent
ef27cb5a9b
commit
fd2d817ba7
2 changed files with 7 additions and 1 deletions
|
@ -15,6 +15,7 @@ import { selectActiveChannelClaim } from 'redux/selectors/app';
|
|||
import { selectSettingsByChannelId } from 'redux/selectors/comments';
|
||||
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
||||
import * as SETTINGS from 'constants/settings';
|
||||
import { doSetClientSetting } from 'redux/actions/settings';
|
||||
|
||||
const select = (state, props) => {
|
||||
const claim = selectClaimForUri(state, props.uri);
|
||||
|
@ -27,6 +28,7 @@ const select = (state, props) => {
|
|||
settingsByChannelId: selectSettingsByChannelId(state),
|
||||
supportDisabled: makeSelectTagInClaimOrChannelForUri(props.uri, DISABLE_SUPPORT_TAG)(state),
|
||||
customCommentServers: makeSelectClientSetting(SETTINGS.CUSTOM_COMMENTS_SERVERS)(state),
|
||||
commentServer: makeSelectClientSetting(SETTINGS.CUSTOM_COMMENTS_SERVER_URL)(state),
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -37,6 +39,7 @@ const perform = (dispatch, ownProps) => ({
|
|||
doToast: (options) => dispatch(doToast(options)),
|
||||
fetchComment: (commentId) => dispatch(doCommentById(commentId, false)),
|
||||
sendTip: (params, callback, errorCallback) => dispatch(doSendTip(params, false, callback, errorCallback, false)),
|
||||
setCommentServer: (url) => dispatch(doSetClientSetting(SETTINGS.CUSTOM_COMMENTS_SERVER_URL, url, true)),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(CommentCreate);
|
||||
|
|
|
@ -65,6 +65,8 @@ type Props = {
|
|||
setQuickReply: (any) => void,
|
||||
toast: (string) => void,
|
||||
customCommentServers: Array<CommentServerDetails>,
|
||||
setCommentServer: (string) => void,
|
||||
commentServer: string,
|
||||
};
|
||||
|
||||
export function CommentCreate(props: Props) {
|
||||
|
@ -90,6 +92,8 @@ export function CommentCreate(props: Props) {
|
|||
sendTip,
|
||||
setQuickReply,
|
||||
customCommentServers,
|
||||
setCommentServer,
|
||||
commentServer,
|
||||
} = props;
|
||||
|
||||
const defaultServer = { name: COMMENT_SERVER_NAME, url: COMMENT_SERVER_API };
|
||||
|
@ -102,7 +106,6 @@ export function CommentCreate(props: Props) {
|
|||
location: { pathname },
|
||||
} = useHistory();
|
||||
|
||||
const [commentServer, setCommentServer] = React.useState(defaultServer.url);
|
||||
const [isSubmitting, setSubmitting] = React.useState(false);
|
||||
const [commentFailure, setCommentFailure] = React.useState(false);
|
||||
const [successTip, setSuccessTip] = React.useState({ txid: undefined, tipAmount: undefined });
|
||||
|
|
Loading…
Reference in a new issue