Fix prefetch (#2330)

This commit is contained in:
Elias Nahum 2018-11-09 19:04:17 -03:00 committed by GitHub
parent 201e122827
commit b0495a9dff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -31,7 +31,7 @@ const handleRedirectProtocol = (url, response) => {
Client4.doFetchWithResponse = async (url, options) => {
if (!Client4.online) {
throw new ClientError(this.getUrl(), {
throw new ClientError(Client4.getUrl(), {
message: 'no internet connection',
url,
});
@ -63,14 +63,14 @@ Client4.doFetchWithResponse = async (url, options) => {
data = await response.json();
} catch (err) {
if (response && response.resp && response.resp.data && response.resp.data.includes('SSL certificate')) {
throw new ClientError(this.getUrl(), {
throw new ClientError(Client4.getUrl(), {
message: 'You need to use a valid client certificate in order to connect to this Mattermost server',
status_code: 401,
url,
});
}
throw new ClientError(this.getUrl(), {
throw new ClientError(Client4.getUrl(), {
message: 'Received invalid response from the server.',
intl: {
id: t('mobile.request.invalid_response'),
@ -82,8 +82,8 @@ Client4.doFetchWithResponse = async (url, options) => {
if (headers[HEADER_X_CLUSTER_ID] || headers[HEADER_X_CLUSTER_ID.toLowerCase()]) {
const clusterId = headers[HEADER_X_CLUSTER_ID] || headers[HEADER_X_CLUSTER_ID.toLowerCase()];
if (clusterId && this.clusterId !== clusterId) {
this.clusterId = clusterId;
if (clusterId && Client4.clusterId !== clusterId) {
Client4.clusterId = clusterId;
}
}
@ -111,7 +111,7 @@ Client4.doFetchWithResponse = async (url, options) => {
console.error(msg); // eslint-disable-line no-console
}
throw new ClientError(this.getUrl(), {
throw new ClientError(Client4.getUrl(), {
message: msg,
server_error_id: data.id,
status_code: data.status_code,