[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 serverInfo = yield getServerInfo({ server });
|
||||||
|
|
||||||
const loginServicesLength = yield RocketChat.getLoginServices(server);
|
if (serverInfo) {
|
||||||
if (loginServicesLength === 0) {
|
const loginServicesLength = yield RocketChat.getLoginServices(server);
|
||||||
Navigation.navigate('LoginView');
|
if (loginServicesLength === 0) {
|
||||||
} else {
|
Navigation.navigate('LoginView');
|
||||||
Navigation.navigate('LoginSignupView');
|
} else {
|
||||||
|
Navigation.navigate('LoginSignupView');
|
||||||
|
}
|
||||||
|
yield put(selectServerRequest(server, serverInfo.version, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
yield put(selectServerRequest(server, serverInfo.version, false));
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
yield put(serverFailure());
|
yield put(serverFailure());
|
||||||
log(e);
|
log(e);
|
||||||
|
|
|
@ -134,8 +134,8 @@ class NewServerView extends React.Component {
|
||||||
const certificatePath = `${ FileSystem.documentDirectory }/${ certificate.name }`;
|
const certificatePath = `${ FileSystem.documentDirectory }/${ certificate.name }`;
|
||||||
try {
|
try {
|
||||||
await FileSystem.copyAsync({ from: certificate.path, to: certificatePath });
|
await FileSystem.copyAsync({ from: certificate.path, to: certificatePath });
|
||||||
} catch (error) {
|
} catch (e) {
|
||||||
log('err_save_certificate', error);
|
log(e);
|
||||||
}
|
}
|
||||||
cert = {
|
cert = {
|
||||||
path: this.uriToPath(certificatePath), // file:// isn't allowed by obj-C
|
path: this.uriToPath(certificatePath), // file:// isn't allowed by obj-C
|
||||||
|
@ -166,9 +166,9 @@ class NewServerView extends React.Component {
|
||||||
],
|
],
|
||||||
'secure-text',
|
'secure-text',
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (e) {
|
||||||
if (!DocumentPicker.isCancel(error)) {
|
if (!DocumentPicker.isCancel(e)) {
|
||||||
log('err_choose_certificate', error);
|
log(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue