summaryrefslogtreecommitdiffstats
path: root/webapp/utils/async_client.jsx
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2017-04-25 11:46:02 -0400
committerChristopher Speller <crspeller@gmail.com>2017-04-25 11:46:02 -0400
commit6c4c706313eb765eb00c639f381646be74f27b69 (patch)
tree6068feaa9668dcd74601730ac1a5abfb366402b1 /webapp/utils/async_client.jsx
parentcc07c005074348de87854f1c953a549e8772fa03 (diff)
downloadchat-6c4c706313eb765eb00c639f381646be74f27b69.tar.gz
chat-6c4c706313eb765eb00c639f381646be74f27b69.tar.bz2
chat-6c4c706313eb765eb00c639f381646be74f27b69.zip
Start moving webapp to Redux (#6140)
* Start moving webapp to Redux * Fix localforage import * Updates per feedback * Feedback udpates and a few fixes * Minor updates * Fix statuses, config not loading properly, getMe sanitizing too much * Fix preferences * Fix user autocomplete * Fix sessions and audits * Fix error handling for all redux actions * Use new directory structure for components and containers * Refresh immediately on logout instead of after timeout * Add fetch polyfill
Diffstat (limited to 'webapp/utils/async_client.jsx')
-rw-r--r--webapp/utils/async_client.jsx226
1 files changed, 0 insertions, 226 deletions
diff --git a/webapp/utils/async_client.jsx b/webapp/utils/async_client.jsx
index abc1017fa..cb911cb55 100644
--- a/webapp/utils/async_client.jsx
+++ b/webapp/utils/async_client.jsx
@@ -8,7 +8,6 @@ import TeamStore from 'stores/team_store.jsx';
import ErrorStore from 'stores/error_store.jsx';
import * as GlobalActions from 'actions/global_actions.jsx';
-import {loadStatusesForProfilesMap} from 'actions/status_actions.jsx';
import AppDispatcher from 'dispatcher/app_dispatcher.jsx';
import Client from 'client/web_client.jsx';
@@ -323,231 +322,6 @@ export function getUser(userId, success, error) {
);
}
-export function getProfiles(offset = UserStore.getPagingOffset(), limit = Constants.PROFILE_CHUNK_SIZE) {
- const callName = `getProfiles${offset}${limit}`;
-
- if (isCallInProgress(callName)) {
- return;
- }
-
- callTracker[callName] = utils.getTimestamp();
- Client.getProfiles(
- offset,
- limit,
- (data) => {
- callTracker[callName] = 0;
-
- AppDispatcher.handleServerAction({
- type: ActionTypes.RECEIVED_PROFILES,
- profiles: data
- });
- },
- (err) => {
- callTracker[callName] = 0;
- dispatchError(err, 'getProfiles');
- }
- );
-}
-
-export function getProfilesInTeam(teamId = TeamStore.getCurrentId(), offset = UserStore.getInTeamPagingOffset(), limit = Constants.PROFILE_CHUNK_SIZE) {
- const callName = `getProfilesInTeam${teamId}${offset}${limit}`;
-
- if (isCallInProgress(callName)) {
- return;
- }
-
- callTracker[callName] = utils.getTimestamp();
- Client.getProfilesInTeam(
- teamId,
- offset,
- limit,
- (data) => {
- callTracker[callName] = 0;
-
- AppDispatcher.handleServerAction({
- type: ActionTypes.RECEIVED_PROFILES_IN_TEAM,
- profiles: data,
- team_id: teamId,
- offset,
- count: Object.keys(data).length
- });
- },
- (err) => {
- callTracker[callName] = 0;
- dispatchError(err, 'getProfilesInTeam');
- }
- );
-}
-
-export function getProfilesNotInTeam(teamId = TeamStore.getCurrentId(), offset = UserStore.getInTeamPagingOffset(), limit = Constants.PROFILE_CHUNK_SIZE) {
- const callName = `getProfilesNotInTeam${teamId}${offset}${limit}`;
-
- if (isCallInProgress(callName)) {
- return;
- }
-
- callTracker[callName] = utils.getTimestamp();
- Client.getProfilesNotInTeam(
- teamId,
- offset,
- limit,
- (data) => {
- callTracker[callName] = 0;
-
- AppDispatcher.handleServerAction({
- type: ActionTypes.RECEIVED_PROFILES_NOT_IN_TEAM,
- profiles: data,
- team_id: teamId,
- offset,
- count: Object.keys(data).length
- });
- },
- (err) => {
- callTracker[callName] = 0;
- dispatchError(err, 'getProfilesNotInTeam');
- }
- );
-}
-
-export function getProfilesInChannel(channelId = ChannelStore.getCurrentId(), offset = UserStore.getInChannelPagingOffset(), limit = Constants.PROFILE_CHUNK_SIZE) {
- const callName = `getProfilesInChannel${channelId}${offset}${limit}`;
-
- if (isCallInProgress()) {
- return;
- }
-
- callTracker[callName] = utils.getTimestamp();
- Client.getProfilesInChannel(
- channelId,
- offset,
- limit,
- (data) => {
- callTracker[callName] = 0;
-
- AppDispatcher.handleServerAction({
- type: ActionTypes.RECEIVED_PROFILES_IN_CHANNEL,
- channel_id: channelId,
- profiles: data,
- offset,
- count: Object.keys(data).length
- });
-
- loadStatusesForProfilesMap(data);
- },
- (err) => {
- callTracker[callName] = 0;
- dispatchError(err, 'getProfilesInChannel');
- }
- );
-}
-
-export function getProfilesNotInChannel(channelId = ChannelStore.getCurrentId(), offset = UserStore.getNotInChannelPagingOffset(), limit = Constants.PROFILE_CHUNK_SIZE) {
- const callName = `getProfilesNotInChannel${channelId}${offset}${limit}`;
-
- if (isCallInProgress(callName)) {
- return;
- }
-
- callTracker[callName] = utils.getTimestamp();
- Client.getProfilesNotInChannel(
- channelId,
- offset,
- limit,
- (data) => {
- callTracker[callName] = 0;
-
- AppDispatcher.handleServerAction({
- type: ActionTypes.RECEIVED_PROFILES_NOT_IN_CHANNEL,
- channel_id: channelId,
- profiles: data,
- offset,
- count: Object.keys(data).length
- });
-
- loadStatusesForProfilesMap(data);
- },
- (err) => {
- callTracker[callName] = 0;
- dispatchError(err, 'getProfilesNotInChannel');
- }
- );
-}
-
-export function getProfilesByIds(userIds) {
- const callName = 'getProfilesByIds' + JSON.stringify(userIds);
-
- if (isCallInProgress(callName)) {
- return;
- }
-
- if (!userIds || userIds.length === 0) {
- return;
- }
-
- callTracker[callName] = utils.getTimestamp();
- Client.getProfilesByIds(
- userIds,
- (data) => {
- callTracker[callName] = 0;
-
- AppDispatcher.handleServerAction({
- type: ActionTypes.RECEIVED_PROFILES,
- profiles: data
- });
- },
- (err) => {
- callTracker[callName] = 0;
- dispatchError(err, 'getProfilesByIds');
- }
- );
-}
-
-export function getSessions() {
- if (isCallInProgress('getSessions')) {
- return;
- }
-
- callTracker.getSessions = utils.getTimestamp();
- Client.getSessions(
- UserStore.getCurrentId(),
- (data) => {
- callTracker.getSessions = 0;
-
- AppDispatcher.handleServerAction({
- type: ActionTypes.RECEIVED_SESSIONS,
- sessions: data
- });
- },
- (err) => {
- callTracker.getSessions = 0;
- dispatchError(err, 'getSessions');
- }
- );
-}
-
-export function getAudits() {
- if (isCallInProgress('getAudits')) {
- return;
- }
-
- callTracker.getAudits = utils.getTimestamp();
- Client.getAudits(
- UserStore.getCurrentId(),
- (data) => {
- callTracker.getAudits = 0;
-
- AppDispatcher.handleServerAction({
- type: ActionTypes.RECEIVED_AUDITS,
- audits: data
- });
- },
- (err) => {
- callTracker.getAudits = 0;
- dispatchError(err, 'getAudits');
- }
- );
-}
-
export function getLogs() {
if (isCallInProgress('getLogs')) {
return;