[FIX] Share Extension shows a server that has no user logged in (#4336)
* [FIX] Share Extension shows a server that has no user logged in * set server after login
This commit is contained in:
parent
affa768728
commit
30af60cd58
|
@ -20,7 +20,7 @@ import { inquiryRequest, inquiryReset } from '../ee/omnichannel/actions/inquiry'
|
||||||
import { isOmnichannelStatusAvailable } from '../ee/omnichannel/lib';
|
import { isOmnichannelStatusAvailable } from '../ee/omnichannel/lib';
|
||||||
import { RootEnum } from '../definitions';
|
import { RootEnum } from '../definitions';
|
||||||
import sdk from '../lib/services/sdk';
|
import sdk from '../lib/services/sdk';
|
||||||
import { TOKEN_KEY } from '../lib/constants';
|
import { CURRENT_SERVER, TOKEN_KEY } from '../lib/constants';
|
||||||
import {
|
import {
|
||||||
getCustomEmojis,
|
getCustomEmojis,
|
||||||
getEnterpriseModules,
|
getEnterpriseModules,
|
||||||
|
@ -181,9 +181,9 @@ const handleLoginSuccess = function* handleLoginSuccess({ user }) {
|
||||||
|
|
||||||
UserPreferences.setString(`${TOKEN_KEY}-${server}`, user.id);
|
UserPreferences.setString(`${TOKEN_KEY}-${server}`, user.id);
|
||||||
UserPreferences.setString(`${TOKEN_KEY}-${user.id}`, user.token);
|
UserPreferences.setString(`${TOKEN_KEY}-${user.id}`, user.token);
|
||||||
|
UserPreferences.setString(CURRENT_SERVER, server);
|
||||||
yield put(setUser(user));
|
yield put(setUser(user));
|
||||||
EventEmitter.emit('connected');
|
EventEmitter.emit('connected');
|
||||||
|
|
||||||
yield put(appStart({ root: RootEnum.ROOT_INSIDE }));
|
yield put(appStart({ root: RootEnum.ROOT_INSIDE }));
|
||||||
const inviteLinkToken = yield select(state => state.inviteLinks.token);
|
const inviteLinkToken = yield select(state => state.inviteLinks.token);
|
||||||
if (inviteLinkToken) {
|
if (inviteLinkToken) {
|
||||||
|
|
|
@ -78,7 +78,6 @@ const handleSelectServer = function* handleSelectServer({ server, version, fetch
|
||||||
yield put(encryptionStop());
|
yield put(encryptionStop());
|
||||||
yield put(clearActiveUsers());
|
yield put(clearActiveUsers());
|
||||||
const serversDB = database.servers;
|
const serversDB = database.servers;
|
||||||
UserPreferences.setString(CURRENT_SERVER, server);
|
|
||||||
const userId = UserPreferences.getString(`${TOKEN_KEY}-${server}`);
|
const userId = UserPreferences.getString(`${TOKEN_KEY}-${server}`);
|
||||||
const userCollections = serversDB.get('users');
|
const userCollections = serversDB.get('users');
|
||||||
let user = null;
|
let user = null;
|
||||||
|
@ -117,6 +116,7 @@ const handleSelectServer = function* handleSelectServer({ server, version, fetch
|
||||||
yield put(setUser(user));
|
yield put(setUser(user));
|
||||||
yield connect({ server, logoutOnError: true });
|
yield connect({ server, logoutOnError: true });
|
||||||
yield put(appStart({ root: RootEnum.ROOT_INSIDE }));
|
yield put(appStart({ root: RootEnum.ROOT_INSIDE }));
|
||||||
|
UserPreferences.setString(CURRENT_SERVER, server); // only set server after have a user
|
||||||
} else {
|
} else {
|
||||||
yield put(clearUser());
|
yield put(clearUser());
|
||||||
yield connect({ server });
|
yield connect({ server });
|
||||||
|
|
Loading…
Reference in New Issue