Inital support for multi-tab loging
Этот коммит содержится в:
@@ -3,6 +3,7 @@
|
||||
|
||||
var client = require('./client.jsx');
|
||||
var AppDispatcher = require('../dispatcher/app_dispatcher.jsx');
|
||||
var BrowserStore = require('../stores/browser_store.jsx');
|
||||
var ChannelStore = require('../stores/channel_store.jsx');
|
||||
var PostStore = require('../stores/post_store.jsx');
|
||||
var UserStore = require('../stores/user_store.jsx');
|
||||
@@ -50,18 +51,18 @@ export function getChannels(force, updateLastViewed, checkVersion) {
|
||||
callTracker.getChannels = utils.getTimestamp();
|
||||
|
||||
client.getChannels(
|
||||
function getChannelsSuccess(data, textStatus, xhr) {
|
||||
(data, textStatus, xhr) => {
|
||||
callTracker.getChannels = 0;
|
||||
|
||||
if (checkVersion) {
|
||||
var serverVersion = xhr.getResponseHeader('X-Version-ID');
|
||||
|
||||
if (!UserStore.getLastVersion()) {
|
||||
UserStore.setLastVersion(serverVersion);
|
||||
if (!BrowserStore.getLastServerVersion()) {
|
||||
BrowserStore.setLastServerVersion(serverVersion);
|
||||
}
|
||||
|
||||
if (serverVersion !== UserStore.getLastVersion()) {
|
||||
UserStore.setLastVersion(serverVersion);
|
||||
if (serverVersion !== BrowserStore.getLastServerVersion()) {
|
||||
BrowserStore.setLastServerVersion(serverVersion);
|
||||
window.location.href = window.location.href;
|
||||
console.log('Detected version update refreshing the page'); //eslint-disable-line no-console
|
||||
}
|
||||
@@ -77,7 +78,7 @@ export function getChannels(force, updateLastViewed, checkVersion) {
|
||||
members: data.members
|
||||
});
|
||||
},
|
||||
function getChannelsFailure(err) {
|
||||
(err) => {
|
||||
callTracker.getChannels = 0;
|
||||
dispatchError(err, 'getChannels');
|
||||
}
|
||||
@@ -566,8 +567,8 @@ export function getMe() {
|
||||
}
|
||||
|
||||
callTracker.getMe = utils.getTimestamp();
|
||||
client.getMeSynchronous(
|
||||
function getMeSyncSuccess(data, textStatus, xhr) {
|
||||
client.getMe(
|
||||
(data, textStatus, xhr) => {
|
||||
callTracker.getMe = 0;
|
||||
|
||||
if (xhr.status === 304 || !data) {
|
||||
@@ -579,7 +580,7 @@ export function getMe() {
|
||||
me: data
|
||||
});
|
||||
},
|
||||
function getMeSyncFailure(err) {
|
||||
(err) => {
|
||||
callTracker.getMe = 0;
|
||||
dispatchError(err, 'getMe');
|
||||
}
|
||||
|
||||
@@ -232,6 +232,7 @@ export function logout() {
|
||||
track('api', 'api_users_logout');
|
||||
var currentTeamUrl = TeamStore.getCurrentTeamUrl();
|
||||
BrowserStore.clear();
|
||||
ErrorStore.storeLastError(null);
|
||||
window.location.href = currentTeamUrl + '/logout';
|
||||
}
|
||||
|
||||
@@ -385,10 +386,9 @@ export function getAllTeams(success, error) {
|
||||
});
|
||||
}
|
||||
|
||||
export function getMeSynchronous(success, error) {
|
||||
export function getMe(success, error) {
|
||||
var currentUser = null;
|
||||
$.ajax({
|
||||
async: false,
|
||||
cache: false,
|
||||
url: '/api/v1/users/me',
|
||||
dataType: 'json',
|
||||
@@ -402,7 +402,7 @@ export function getMeSynchronous(success, error) {
|
||||
},
|
||||
error: function onError(xhr, status, err) {
|
||||
if (error) {
|
||||
var e = handleError('getMeSynchronous', xhr, status, err);
|
||||
var e = handleError('getMe', xhr, status, err);
|
||||
error(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,6 @@ module.exports = {
|
||||
|
||||
RECIEVED_MSG: null,
|
||||
|
||||
CLICK_TEAM: null,
|
||||
RECIEVED_TEAM: null,
|
||||
|
||||
RECIEVED_CONFIG: null,
|
||||
|
||||
Ссылка в новой задаче
Block a user