[FIX] Prevent navigation if serverInfo is undefined (#1170)
* Fix navigate when serverInfo is undefined * Fix logs
This commit is contained in:
parent
2515295fc6
commit
0ea0dc2aad
|
@ -86,14 +86,15 @@ const handleServerRequest = function* handleServerRequest({ server, certificate
|
|||
|
||||
const serverInfo = yield getServerInfo({ server });
|
||||
|
||||
const loginServicesLength = yield RocketChat.getLoginServices(server);
|
||||
if (loginServicesLength === 0) {
|
||||
Navigation.navigate('LoginView');
|
||||
} else {
|
||||
Navigation.navigate('LoginSignupView');
|
||||
if (serverInfo) {
|
||||
const loginServicesLength = yield RocketChat.getLoginServices(server);
|
||||
if (loginServicesLength === 0) {
|
||||
Navigation.navigate('LoginView');
|
||||
} else {
|
||||
Navigation.navigate('LoginSignupView');
|
||||
}
|
||||
yield put(selectServerRequest(server, serverInfo.version, false));
|
||||
}
|
||||
|
||||
yield put(selectServerRequest(server, serverInfo.version, false));
|
||||
} catch (e) {
|
||||
yield put(serverFailure());
|
||||
log(e);
|
||||
|
|
|
@ -134,8 +134,8 @@ class NewServerView extends React.Component {
|
|||
const certificatePath = `${ FileSystem.documentDirectory }/${ certificate.name }`;
|
||||
try {
|
||||
await FileSystem.copyAsync({ from: certificate.path, to: certificatePath });
|
||||
} catch (error) {
|
||||
log('err_save_certificate', error);
|
||||
} catch (e) {
|
||||
log(e);
|
||||
}
|
||||
cert = {
|
||||
path: this.uriToPath(certificatePath), // file:// isn't allowed by obj-C
|
||||
|
@ -166,9 +166,9 @@ class NewServerView extends React.Component {
|
|||
],
|
||||
'secure-text',
|
||||
);
|
||||
} catch (error) {
|
||||
if (!DocumentPicker.isCancel(error)) {
|
||||
log('err_choose_certificate', error);
|
||||
} catch (e) {
|
||||
if (!DocumentPicker.isCancel(e)) {
|
||||
log(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue