* Remove mattermost-redux * Move mm-redux files into app/redux * Add @redux path to tsconfig.json * Fix imports * Install missing dependencies * Fix tsc errors * Fix i18n_utils test * Fix more imports * Remove redux websocket * Fix tests * Rename @redux * Apply changes from mattermost-redux PR 1103 * Remove mattermost-redux mention in template * Add missing imports * Rename app/redux/ to app/mm-redux/ * Remove test file * Fix fetching Sidebar GM profiles Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
34 lines
941 B
JavaScript
34 lines
941 B
JavaScript
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
import {Client4} from '@mm-redux/client';
|
|
import CookieManager from 'react-native-cookies';
|
|
|
|
let mfaPreflightDone = false;
|
|
|
|
export function setMfaPreflightDone(state) {
|
|
mfaPreflightDone = state;
|
|
}
|
|
|
|
export function getMfaPreflightDone() {
|
|
return mfaPreflightDone;
|
|
}
|
|
|
|
export function setCSRFFromCookie(url) {
|
|
return new Promise((resolve) => {
|
|
CookieManager.get(url, false).then((res) => {
|
|
const token = res.MMCSRF;
|
|
if (token) {
|
|
let value = null;
|
|
if (typeof token === 'object' && Object.prototype.hasOwnProperty.call(token, 'value')) {
|
|
value = token.value;
|
|
} else {
|
|
value = token;
|
|
}
|
|
|
|
Client4.setCSRF(value);
|
|
}
|
|
resolve();
|
|
});
|
|
});
|
|
}
|