summaryrefslogtreecommitdiffstats
path: root/web/react/utils
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2015-10-16 08:16:40 -0400
committerChristopher Speller <crspeller@gmail.com>2015-10-16 08:16:40 -0400
commit099d8538770271bfc41416b871a899362bf9a086 (patch)
tree103ecc42fe274694d387a4e5969f860767594139 /web/react/utils
parent269476d694f425764dbe0cccd4eaa3f23956ba61 (diff)
parent327b0b5a2119ae888c812f682b3934061b8f59bf (diff)
downloadchat-099d8538770271bfc41416b871a899362bf9a086.tar.gz
chat-099d8538770271bfc41416b871a899362bf9a086.tar.bz2
chat-099d8538770271bfc41416b871a899362bf9a086.zip
Merge pull request #1079 from hmhealey/initprefs
Added an initial call to get all user preferences on page load
Diffstat (limited to 'web/react/utils')
-rw-r--r--web/react/utils/async_client.jsx15
-rw-r--r--web/react/utils/client.jsx13
2 files changed, 20 insertions, 8 deletions
diff --git a/web/react/utils/async_client.jsx b/web/react/utils/async_client.jsx
index 1bf8a6fee..b22d7237e 100644
--- a/web/react/utils/async_client.jsx
+++ b/web/react/utils/async_client.jsx
@@ -638,16 +638,15 @@ export function getMyTeam() {
);
}
-export function getDirectChannelPreferences() {
- if (isCallInProgress('getDirectChannelPreferences')) {
+export function getAllPreferences() {
+ if (isCallInProgress('getAllPreferences')) {
return;
}
- callTracker.getDirectChannelPreferences = utils.getTimestamp();
- client.getPreferenceCategory(
- Constants.Preferences.CATEGORY_DIRECT_CHANNEL_SHOW,
+ callTracker.getAllPreferences = utils.getTimestamp();
+ client.getAllPreferences(
(data, textStatus, xhr) => {
- callTracker.getDirectChannelPreferences = 0;
+ callTracker.getAllPreferences = 0;
if (xhr.status === 304 || !data) {
return;
@@ -659,8 +658,8 @@ export function getDirectChannelPreferences() {
});
},
(err) => {
- callTracker.getDirectChannelPreferences = 0;
- dispatchError(err, 'getDirectChannelPreferences');
+ callTracker.getAllPreferences = 0;
+ dispatchError(err, 'getAllPreferences');
}
);
}
diff --git a/web/react/utils/client.jsx b/web/react/utils/client.jsx
index 76a402855..f6aee362c 100644
--- a/web/react/utils/client.jsx
+++ b/web/react/utils/client.jsx
@@ -1142,6 +1142,19 @@ export function listIncomingHooks(success, error) {
});
}
+export function getAllPreferences(success, error) {
+ $.ajax({
+ url: `/api/v1/preferences/`,
+ dataType: 'json',
+ type: 'GET',
+ success,
+ error: (xhr, status, err) => {
+ var e = handleError('getAllPreferences', xhr, status, err);
+ error(e);
+ }
+ });
+}
+
export function getPreferenceCategory(category, success, error) {
$.ajax({
url: `/api/v1/preferences/${category}`,