mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-11-29 11:12:18 +03:00
made some changes to account data repair routines
This commit is contained in:
parent
411ee5b77b
commit
6925307256
@ -381,21 +381,18 @@ class ApplicationContainer extends Component {
|
||||
} = this.props;
|
||||
let realmData = [];
|
||||
|
||||
if (currentAccount?.username) {
|
||||
if (currentAccount?.name) {
|
||||
dispatch(login(true));
|
||||
|
||||
const { username } = currentAccount;
|
||||
const username = currentAccount.name;
|
||||
|
||||
let reduxAccountNames = otherAccounts.map((account) => account.username);
|
||||
|
||||
const userData = await getUserData();
|
||||
|
||||
if (userData && userData.length > 0) {
|
||||
realmData = userData;
|
||||
userData.forEach((accountData, index) => {
|
||||
reduxAccountNames = reduxAccountNames.filter(
|
||||
(username) => username !== accountData.username,
|
||||
);
|
||||
|
||||
if (
|
||||
!accountData ||
|
||||
(!accountData.accessToken &&
|
||||
|
@ -228,10 +228,11 @@ export const repairUserAccountData = async (username, dispatch, intl, accounts,
|
||||
|
||||
export const repairOtherAccountsData = (accounts, realmAuthData, dispatch, ) => {
|
||||
accounts.forEach((account) => {
|
||||
const accRealmData = realmAuthData.find(data => data.username === account.username)
|
||||
if(!account.local?.accessToken && accRealmData){
|
||||
const accRealmData = realmAuthData.find(data => data.username === account.name)
|
||||
if((!account.local?.accessToken || !account.username) && accRealmData){
|
||||
account.local = accRealmData;
|
||||
dispatch(updateOtherAccount({...account}))
|
||||
account.username = accRealmData.username;
|
||||
dispatch(updateOtherAccount({...account}));
|
||||
}
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user