Commit 7bc0106a authored by / /\ / /\/'s avatar / /\ / /\/
Browse files

Revert "working error handling on account create"

This reverts commit de88d337.
parent e590bbe8
......@@ -8,24 +8,13 @@ import { key_utils } from '@steemit/steem-js/lib/auth/ecc';
class CreateCommunity extends React.Component {
constructor() {
super();
this.state = { error: false, errorMessage: '' };
}
componentDidUpdate(prevProps, prevState) {
if (this.props.hasTransactionError && !prevProps.hasTransactionError) {
this.setState({
errorMessage: 'There was a transaction error.',
});
}
if (this.props.loginError && !prevProps.loginError) {
this.setState({
errorMessage: 'There was a credentials error.',
});
}
this.state = { error: false };
}
render() {
const errorCB = () => {
debugger;
// Can we dispatch from within here.
this.setState({ error: true });
};
......@@ -52,6 +41,8 @@ class CreateCommunity extends React.Component {
hasTransactionError,
} = this.props;
console.log(this.state.error);
const handleCommunityTitleInput = e => {
if (e.target.value.length > 32) {
return;
......@@ -79,7 +70,6 @@ class CreateCommunity extends React.Component {
communityOwnerWifPassword,
};
createCommunity(createCommunitypayload, errorCB);
this.setState({ error: false, errorMessage: '' });
};
const generateCommunityOwnerName = () => {
......@@ -158,15 +148,17 @@ class CreateCommunity extends React.Component {
);
const createCommunityErrorMessage = (
<div>
<div>{tt('g.community_error')}</div>
<div>{this.state.errorMessage}</div>
<div>{tt('g.community_create_try_again')} </div>
</div>
<div>{tt('g.community_error')}</div>
);
const createCommunityLoadingMessage = (
<div>{tt('g.community_creating')}</div>
);
const createCommunityPasswordError = (
<div>
<div>{tt('g.community_create_password_error')}</div>
<div>{loginError}</div>
</div>
);
const createCommunityCustomOpsPendingMessage = (
<div>{`${tt(
'g.community_broadcasting_custom_ops'
......@@ -230,14 +222,12 @@ class CreateCommunity extends React.Component {
return (
<div className="row">
<div className="column large-6 small-12">
{this.state.error && createCommunityErrorMessage}
{this.state.error && createCommunityForm}
{loginError && createCommunityPasswordError}
{hasTransactionError && <div>THERE WAS AN ERROR!</div>}
{!communityCreatePending &&
!communityCreateSuccess &&
createCommunityForm}
{communityCreatePending &&
!this.state.error &&
createCommunityLoadingMessage}
{communityCreatePending && createCommunityLoadingMessage}
{communityHivemindOperationPending &&
createCommunityCustomOpsPendingMessage}
{communityCreateSuccess && createCommunitySuccessMessage}
......
......@@ -27,7 +27,6 @@
"community_creating": "Your community is being created...",
"community_create_password_error":
"There was a problem with your credentials:",
"community_create_try_again": "Please try again:",
"community_broadcasting_custom_ops": "Making",
"community_broadcasting_custom_ops_1": "administrator of the",
"community_broadcasting_custom_ops_2": "community.",
......
......@@ -75,6 +75,7 @@ export default function reducer(state = defaultState, action) {
}
case CREATE_COMMUNITY_ERROR: {
const err = fromJS(payload);
debugger;
return state.merge({ communityCreateError: err });
}
case CREATE_COMMUNITY_SUCCESS: {
......@@ -137,6 +138,7 @@ export const createCommunityAccountPending = payload => ({
});
export const createCommunityAccountError = payload => {
debugger;
return {
type: CREATE_COMMUNITY_ACCOUNT_ERROR,
payload,
......
......@@ -40,6 +40,7 @@ export const communityWatches = [
),
];
export function* createAccountError(action) {
debugger;
yield put({
type: communityActions.CREATE_COMMUNITY_ACCOUNT_PENDING,
payload: false,
......@@ -186,6 +187,8 @@ export function* createCommunityAccount(createCommunityAction) {
successCallback();
},
errorCallback: res => {
debugger;
console.log('error', res);
errorCallback(res);
},
})
......
......@@ -28,6 +28,7 @@ export default function reducer(state = defaultState, action) {
const operation = fromJS(payload.operation);
const confirm = payload.confirm;
const warning = payload.warning;
debugger;
return state.merge({
show_confirm_modal: true,
confirmBroadcastOperation: operation,
......
......@@ -132,6 +132,7 @@ export function* broadcastOperation({
const warning = tt('g.post_key_warning.warning');
const checkbox = tt('g.post_key_warning.checkbox');
operationParam.allowPostUnsafe = true;
debugger;
yield put(
transactionActions.confirmOperation({
confirm,
......@@ -182,6 +183,7 @@ export function* broadcastOperation({
serverApiRecordEvent(eventType, page);
} catch (error) {
console.error('TransactionSage', error);
debugger;
if (errorCallback) errorCallback(error.toString());
}
}
......
......@@ -203,6 +203,7 @@ export default function reducer(state = defaultState, action) {
});
case LOGIN_ERROR:
debugger;
return state.merge({
login_error: payload.error,
logged_out: undefined,
......
......@@ -219,6 +219,7 @@ function* usernamePasswordLogin({
Set()
);
if (!fullAuths.size) {
debugger;
console.log('No full auths');
localStorage.removeItem('autopost2');
const generated_type = password[0] === 'P' && password.length > 40;
......
......@@ -23,6 +23,7 @@ export function serverApiLogout() {
const request = Object.assign({}, request_base, {
body: JSON.stringify({ csrf: $STM_csrf }),
});
debugger;
return fetch('/api/v1/logout_account', request);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment