diff options
Diffstat (limited to 'web/react/utils')
-rw-r--r-- | web/react/utils/async_client.jsx | 23 | ||||
-rw-r--r-- | web/react/utils/client.jsx | 12 | ||||
-rw-r--r-- | web/react/utils/constants.jsx | 3 |
3 files changed, 18 insertions, 20 deletions
diff --git a/web/react/utils/async_client.jsx b/web/react/utils/async_client.jsx index a0ccccd88..1bf8a6fee 100644 --- a/web/react/utils/async_client.jsx +++ b/web/react/utils/async_client.jsx @@ -638,17 +638,16 @@ export function getMyTeam() { ); } -export function getDirectChannels() { - if (isCallInProgress('getDirectChannels')) { +export function getDirectChannelPreferences() { + if (isCallInProgress('getDirectChannelPreferences')) { return; } - callTracker.getDirectChannels = utils.getTimestamp(); - client.getPreferencesByName( - Constants.Preferences.CATEGORY_DIRECT_CHANNELS, - Constants.Preferences.NAME_SHOW, + callTracker.getDirectChannelPreferences = utils.getTimestamp(); + client.getPreferenceCategory( + Constants.Preferences.CATEGORY_DIRECT_CHANNEL_SHOW, (data, textStatus, xhr) => { - callTracker.getDirectChannels = 0; + callTracker.getDirectChannelPreferences = 0; if (xhr.status === 304 || !data) { return; @@ -660,14 +659,14 @@ export function getDirectChannels() { }); }, (err) => { - callTracker.getDirectChannels = 0; - dispatchError(err, 'getDirectChannels'); + callTracker.getDirectChannelPreferences = 0; + dispatchError(err, 'getDirectChannelPreferences'); } ); } -export function setPreferences(preferences, success, error) { - client.setPreferences( +export function savePreferences(preferences, success, error) { + client.savePreferences( preferences, (data, textStatus, xhr) => { if (xhr.status !== 304) { @@ -682,7 +681,7 @@ export function setPreferences(preferences, success, error) { } }, (err) => { - dispatchError(err, 'setPreferences'); + dispatchError(err, 'savePreferences'); if (error) { error(); diff --git a/web/react/utils/client.jsx b/web/react/utils/client.jsx index 4e3505ad2..76a402855 100644 --- a/web/react/utils/client.jsx +++ b/web/react/utils/client.jsx @@ -1142,29 +1142,29 @@ export function listIncomingHooks(success, error) { }); } -export function getPreferencesByName(category, name, success, error) { +export function getPreferenceCategory(category, success, error) { $.ajax({ - url: `/api/v1/preferences/${category}/${name}`, + url: `/api/v1/preferences/${category}`, dataType: 'json', type: 'GET', success, error: (xhr, status, err) => { - var e = handleError('getPreferencesByName', xhr, status, err); + var e = handleError('getPreferenceCategory', xhr, status, err); error(e); } }); } -export function setPreferences(preferences, success, error) { +export function savePreferences(preferences, success, error) { $.ajax({ - url: '/api/v1/preferences/set', + url: '/api/v1/preferences/save', dataType: 'json', contentType: 'application/json', type: 'POST', data: JSON.stringify(preferences), success, error: (xhr, status, err) => { - var e = handleError('setPreferences', xhr, status, err); + var e = handleError('savePreferences', xhr, status, err); error(e); } }); diff --git a/web/react/utils/constants.jsx b/web/react/utils/constants.jsx index a576b9098..cee2ec114 100644 --- a/web/react/utils/constants.jsx +++ b/web/react/utils/constants.jsx @@ -288,7 +288,6 @@ module.exports = { } ], Preferences: { - CATEGORY_DIRECT_CHANNELS: 'direct_channels', - NAME_SHOW: 'show' + CATEGORY_DIRECT_CHANNEL_SHOW: 'direct_channel_show' } }; |