Added receive of encryption keys

This commit is contained in:
Vladislav Makhov 2020-11-16 12:34:01 +03:00
parent 8f5027418c
commit 07d507b5c5

View File

@ -33,6 +33,7 @@ const {
setCurrentProductId, setCurrentProductId,
setCurrentProductHomePage, setCurrentProductHomePage,
getPortalCultures, getPortalCultures,
getEncryptionKeys,
} = commonStore.auth.actions; } = commonStore.auth.actions;
const { getCurrentUser, isEncryptionSupport } = commonStore.auth.selectors; const { getCurrentUser, isEncryptionSupport } = commonStore.auth.selectors;
const { AUTH_KEY } = constants; const { AUTH_KEY } = constants;
@ -89,12 +90,19 @@ class App extends React.Component {
} }
componentDidUpdate(prevProps) { componentDidUpdate(prevProps) {
const { isAuthenticated, user, isEncryption } = this.props; const {
isAuthenticated,
user,
isEncryption,
keys,
getEncryptionKeys,
} = this.props;
if (isAuthenticated && !this.isDesktopInit) { if (isAuthenticated && !this.isDesktopInit) {
this.isDesktopInit = true;
debugger; debugger;
regDesktop(user, isEncryption); isEncryption && getEncryptionKeys();
this.isDesktopInit = true;
regDesktop(user, isEncryption, keys);
} }
} }
@ -154,6 +162,7 @@ const mapStateToProps = (state) => {
user: getCurrentUser(state), user: getCurrentUser(state),
isAuthenticated: state.auth.isAuthenticated, isAuthenticated: state.auth.isAuthenticated,
isEncryption: isEncryptionSupport(state), isEncryption: isEncryptionSupport(state),
keys: settings.encryptionKeys,
}; };
}; };
@ -169,6 +178,7 @@ const mapDispatchToProps = (dispatch) => {
getPortalCultures: () => getPortalCultures(dispatch), getPortalCultures: () => getPortalCultures(dispatch),
fetchTreeFolders: () => fetchTreeFolders(dispatch), fetchTreeFolders: () => fetchTreeFolders(dispatch),
setIsLoaded: () => dispatch(setIsLoaded(true)), setIsLoaded: () => dispatch(setIsLoaded(true)),
getEncryptionKeys: () => getEncryptionKeys(dispatch),
}; };
}; };