From 5e1e155d07f22150b8a7500d6a05e4557f9bf30e Mon Sep 17 00:00:00 2001 From: Elias Nahum Date: Fri, 9 Nov 2018 19:04:17 -0300 Subject: [PATCH] Fix prefetch (#2330) --- app/fetch_preconfig.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/fetch_preconfig.js b/app/fetch_preconfig.js index c2d905540..f78605801 100644 --- a/app/fetch_preconfig.js +++ b/app/fetch_preconfig.js @@ -29,7 +29,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, }); @@ -49,14 +49,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'), @@ -68,8 +68,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; } } @@ -97,7 +97,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,