From 3f5993eedfd52a0497f7a537601b2d7c9e4d744d Mon Sep 17 00:00:00 2001 From: hmhealey Date: Tue, 11 Aug 2015 14:36:45 -0400 Subject: Added initial api to allow clientside code to query serverside configuration --- web/react/utils/client.jsx | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'web/react/utils/client.jsx') diff --git a/web/react/utils/client.jsx b/web/react/utils/client.jsx index 6a1f7c820..5b5d8dc32 100644 --- a/web/react/utils/client.jsx +++ b/web/react/utils/client.jsx @@ -849,3 +849,24 @@ module.exports.updateValetFeature = function(data, success, error) { module.exports.track('api', 'api_teams_update_valet_feature'); }; + +module.exports.isEmailEnabledSynchronous = function() { + var enabled = false; + + $.ajax({ + async: false, + url: '/api/v1/config/get/bypass_email', + dataType: 'json', + type: 'GET', + success: function(value) { + enabled = !value; + }, + error: function(xhr, status, err) { + if (status != 200) { + handleError("isEmailEnabled", xhr, status, err); + } + } + }); + + return enabled; +}; -- cgit v1.2.3-1-g7c22 From d35065d6fd8237468ee3aa63bfba3b2aa29bc4af Mon Sep 17 00:00:00 2001 From: hmhealey Date: Tue, 11 Aug 2015 16:52:36 -0400 Subject: Reformatted code to match the style guide --- web/react/utils/client.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'web/react/utils/client.jsx') diff --git a/web/react/utils/client.jsx b/web/react/utils/client.jsx index 5b5d8dc32..6ae25c66d 100644 --- a/web/react/utils/client.jsx +++ b/web/react/utils/client.jsx @@ -862,8 +862,8 @@ module.exports.isEmailEnabledSynchronous = function() { enabled = !value; }, error: function(xhr, status, err) { - if (status != 200) { - handleError("isEmailEnabled", xhr, status, err); + if (status !== '200') { + handleError('isEmailEnabled', xhr, status, err); } } }); -- cgit v1.2.3-1-g7c22 From ca919538cc402ed90ce42ffc3ef98994bb1081f4 Mon Sep 17 00:00:00 2001 From: hmhealey Date: Thu, 13 Aug 2015 13:01:21 -0400 Subject: Added ConfigStore that is populated from the server --- web/react/utils/client.jsx | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'web/react/utils/client.jsx') diff --git a/web/react/utils/client.jsx b/web/react/utils/client.jsx index 6ae25c66d..250e3edbd 100644 --- a/web/react/utils/client.jsx +++ b/web/react/utils/client.jsx @@ -850,6 +850,21 @@ module.exports.updateValetFeature = function(data, success, error) { module.exports.track('api', 'api_teams_update_valet_feature'); }; +function getConfig(success, error) { + $.ajax({ + url: '/api/v1/config/get_all', + dataType: 'json', + type: 'GET', + ifModified: true, + success: success, + error: function(xhr, status, err) { + var e = handleError('getConfig', xhr, status, err); + error(e); + } + }); +}; +module.exports.getConfig = getConfig; + module.exports.isEmailEnabledSynchronous = function() { var enabled = false; -- cgit v1.2.3-1-g7c22 From 8fc4456213c5ee16863b7f1bcb20e35a19469a1d Mon Sep 17 00:00:00 2001 From: hmhealey Date: Thu, 13 Aug 2015 13:23:56 -0400 Subject: Removed isEmailEnabledSynchronous and switched the email disabled warnings to use ConfigStore --- web/react/utils/client.jsx | 21 --------------------- 1 file changed, 21 deletions(-) (limited to 'web/react/utils/client.jsx') diff --git a/web/react/utils/client.jsx b/web/react/utils/client.jsx index 250e3edbd..8178ab01a 100644 --- a/web/react/utils/client.jsx +++ b/web/react/utils/client.jsx @@ -864,24 +864,3 @@ function getConfig(success, error) { }); }; module.exports.getConfig = getConfig; - -module.exports.isEmailEnabledSynchronous = function() { - var enabled = false; - - $.ajax({ - async: false, - url: '/api/v1/config/get/bypass_email', - dataType: 'json', - type: 'GET', - success: function(value) { - enabled = !value; - }, - error: function(xhr, status, err) { - if (status !== '200') { - handleError('isEmailEnabled', xhr, status, err); - } - } - }); - - return enabled; -}; -- cgit v1.2.3-1-g7c22