From 5a597c96061712e1a08ddec2c15129ba2ed9e4f3 Mon Sep 17 00:00:00 2001 From: Reed Garmsen Date: Tue, 30 Jun 2015 20:40:27 -0700 Subject: Added line that disables caching with a ajax client call that was causing errors to be thrown in IE10 --- web/react/utils/client.jsx | 1 + 1 file changed, 1 insertion(+) diff --git a/web/react/utils/client.jsx b/web/react/utils/client.jsx index 15b6ace91..a43e4eec5 100644 --- a/web/react/utils/client.jsx +++ b/web/react/utils/client.jsx @@ -280,6 +280,7 @@ module.exports.getMeSynchronous = function(success, error) { url: "/api/v1/users/me", dataType: 'json', contentType: 'application/json', + cache: false, type: 'GET', success: function(data, textStatus, xhr) { current_user = data; -- cgit v1.2.3-1-g7c22 From 6b48dbe231cf1a793b2071cf8e4c751d13f5abad Mon Sep 17 00:00:00 2001 From: Reed Garmsen Date: Wed, 1 Jul 2015 12:30:46 -0700 Subject: Added two possible options for removing blue bar error, will choose one later --- api/user.go | 2 +- web/react/utils/client.jsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/api/user.go b/api/user.go index 292d2b61b..7aad23ab6 100644 --- a/api/user.go +++ b/api/user.go @@ -469,7 +469,7 @@ func getMe(c *Context, w http.ResponseWriter, r *http.Request) { } else { result.Data.(*model.User).Sanitize(map[string]bool{}) w.Header().Set(model.HEADER_ETAG_SERVER, result.Data.(*model.User).Etag()) - w.Header().Set("Expires", "-1") + w.Header().Set("Cache-Control", "max-age=0, public") // should refresh w.Write([]byte(result.Data.(*model.User).ToJson())) return } diff --git a/web/react/utils/client.jsx b/web/react/utils/client.jsx index a43e4eec5..dd835e863 100644 --- a/web/react/utils/client.jsx +++ b/web/react/utils/client.jsx @@ -287,7 +287,7 @@ module.exports.getMeSynchronous = function(success, error) { if (success) success(data, textStatus, xhr); }, error: function(xhr, status, err) { - if (error) { + if (xhr.status != 200 && error) { e = handleError("getMeSynchronous", xhr, status, err); error(e); }; -- cgit v1.2.3-1-g7c22 From 933578ca07c4560a28c7a1bda5b4f5934b1fbb8d Mon Sep 17 00:00:00 2001 From: Reed Garmsen Date: Thu, 2 Jul 2015 08:50:15 -0700 Subject: Removed option that does not work --- api/user.go | 2 +- web/react/utils/client.jsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/api/user.go b/api/user.go index 7aad23ab6..292d2b61b 100644 --- a/api/user.go +++ b/api/user.go @@ -469,7 +469,7 @@ func getMe(c *Context, w http.ResponseWriter, r *http.Request) { } else { result.Data.(*model.User).Sanitize(map[string]bool{}) w.Header().Set(model.HEADER_ETAG_SERVER, result.Data.(*model.User).Etag()) - w.Header().Set("Cache-Control", "max-age=0, public") // should refresh + w.Header().Set("Expires", "-1") w.Write([]byte(result.Data.(*model.User).ToJson())) return } diff --git a/web/react/utils/client.jsx b/web/react/utils/client.jsx index dd835e863..4433df5cf 100644 --- a/web/react/utils/client.jsx +++ b/web/react/utils/client.jsx @@ -280,14 +280,14 @@ module.exports.getMeSynchronous = function(success, error) { url: "/api/v1/users/me", dataType: 'json', contentType: 'application/json', - cache: false, + //cache: false, type: 'GET', success: function(data, textStatus, xhr) { current_user = data; if (success) success(data, textStatus, xhr); }, error: function(xhr, status, err) { - if (xhr.status != 200 && error) { + if (/*xhr.status != 200 && */error) { e = handleError("getMeSynchronous", xhr, status, err); error(e); }; -- cgit v1.2.3-1-g7c22 From e51a0461a621ed66ede1032d72076cae5b8fdf46 Mon Sep 17 00:00:00 2001 From: Reed Garmsen Date: Thu, 2 Jul 2015 17:54:00 -0700 Subject: Implemented IE10 & 11 specific error suppression when a 200 status (aka OK) error is thrown --- web/react/utils/client.jsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/web/react/utils/client.jsx b/web/react/utils/client.jsx index 4433df5cf..5e9d395c8 100644 --- a/web/react/utils/client.jsx +++ b/web/react/utils/client.jsx @@ -280,16 +280,18 @@ module.exports.getMeSynchronous = function(success, error) { url: "/api/v1/users/me", dataType: 'json', contentType: 'application/json', - //cache: false, type: 'GET', success: function(data, textStatus, xhr) { current_user = data; if (success) success(data, textStatus, xhr); }, error: function(xhr, status, err) { - if (/*xhr.status != 200 && */error) { - e = handleError("getMeSynchronous", xhr, status, err); - error(e); + var ieChecker = window.navigator.userAgent; + if (xhr.status != 200 || !(ieChecker.indexOf("Trident/7.0") > 0 || ieChecker.indexOf("Trident/6.0") > 0)) { + if (error) { + e = handleError("getMeSynchronous", xhr, status, err); + error(e); + }; }; } }); -- cgit v1.2.3-1-g7c22 From 6b1ae67f2fdaa096262be54e4d920bd26034cba5 Mon Sep 17 00:00:00 2001 From: Reed Garmsen Date: Thu, 2 Jul 2015 18:02:00 -0700 Subject: Added comment for later reference --- web/react/utils/client.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/react/utils/client.jsx b/web/react/utils/client.jsx index 5e9d395c8..b4030baac 100644 --- a/web/react/utils/client.jsx +++ b/web/react/utils/client.jsx @@ -286,7 +286,7 @@ module.exports.getMeSynchronous = function(success, error) { if (success) success(data, textStatus, xhr); }, error: function(xhr, status, err) { - var ieChecker = window.navigator.userAgent; + var ieChecker = window.navigator.userAgent; // This and the condition below is used to check specifically for browsers IE10 & 11 to suppress a 200 'OK' error from appearing on login if (xhr.status != 200 || !(ieChecker.indexOf("Trident/7.0") > 0 || ieChecker.indexOf("Trident/6.0") > 0)) { if (error) { e = handleError("getMeSynchronous", xhr, status, err); -- cgit v1.2.3-1-g7c22