fixed actions

This commit is contained in:
Artem Tarasov 2020-07-30 13:50:13 +03:00
parent 2a049f8d78
commit 2e42c813b8
5 changed files with 12 additions and 22 deletions

View File

@ -200,7 +200,7 @@ class Body extends Component {
console.log(emailTrim, password, selectLanguage.key, selectTimezone.key, licenseFile, analytics, wizardToken);
setPortalOwner(emailTrim, password, selectLanguage.key, analytics)
setPortalOwner(password, selectLanguage.key, wizardToken, analytics)
.then(() => history.push(`/`))
.catch( e => this.setState({
errorLoading: true,

View File

@ -3,7 +3,6 @@ const {
setPasswordSettings,
setTimezones,
setPortalCultures,
setCompleteWizard,
getPortalSettings
} = store.auth.actions;
@ -25,10 +24,10 @@ export function setMachineName(machineName) {
};
}
export function setComplete(isComplete) {
export function setComplete(res) {
return {
type: SET_COMPLETE,
isComplete
res
}
}
@ -69,8 +68,9 @@ export function setPortalOwner(email, pwd, lng, confirmKey, analytics) {
return api.settings.setPortalOwner(email, pwd, lng, confirmKey, analytics)
.then((res) => {
console.log(res)
dispatch(setCompleteWizard());
dispatch(setComplete(res));
})
.then(() => getPortalSettings(dispatch))
//.then(() => getPortalSettings(dispatch))
.catch((e) => console.log(e))
}
}

View File

@ -7,8 +7,8 @@ import {
const initState = {
isWizardLoaded: false,
machineName: '',
isComplete: false,
error: false
error: false,
res: null
};
const ownerReducer = ( state = initState, action) => {
@ -26,9 +26,9 @@ const ownerReducer = ( state = initState, action) => {
case SET_COMPLETE:
return Object.assign({}, state, {
isComplete: action.isComplete
res: action.res
});
default:
return state;
}

View File

@ -15,7 +15,6 @@ export const SET_CURRENT_PRODUCT_ID = "SET_CURRENT_PRODUCT_ID";
export const SET_CURRENT_PRODUCT_HOME_PAGE = "SET_CURRENT_PRODUCT_HOME_PAGE";
export const SET_GREETING_SETTINGS = "SET_GREETING_SETTINGS";
export const SET_CUSTOM_NAMES = "SET_CUSTOM_NAMES";
export const SET_WIZARD_COMPLETE = "SET_WIZARD_COMPLETE";
export function setCurrentUser(user) {
return {
@ -115,12 +114,6 @@ export function setCustomNames(customNames) {
};
}
export function setCompleteWizard() {
return {
type: SET_WIZARD_COMPLETE,
}
}
export function getUser(dispatch) {
return api.people.getUser()
.then(user => dispatch(setCurrentUser(user)))

View File

@ -1,7 +1,7 @@
import {
SET_CURRENT_USER, SET_MODULES, SET_SETTINGS, SET_IS_LOADED, LOGOUT, SET_PASSWORD_SETTINGS, SET_NEW_EMAIL,
SET_PORTAL_CULTURES, SET_PORTAL_LANGUAGE_AND_TIME, SET_TIMEZONES, SET_CURRENT_PRODUCT_ID, SET_CURRENT_PRODUCT_HOME_PAGE, SET_GREETING_SETTINGS,
SET_CUSTOM_NAMES, SET_WIZARD_COMPLETE } from './actions';
SET_CUSTOM_NAMES } from './actions';
import isEmpty from "lodash/isEmpty";
import { LANGUAGE, AUTH_KEY } from '../../constants';
@ -103,10 +103,7 @@ const authReducer = (state = initialState, action) => {
settings: state.settings
});
case SET_WIZARD_COMPLETE:
return Object.assign({}, state, {
settings: { ...state.settings, wizardToken: null}
})
default:
return state;
}