Changed updatePinCode function with new structure

This commit is contained in:
Mustafa Buyukcelebi 2019-01-07 00:14:38 +03:00
parent b60aa8be4a
commit 7a329d5ceb

View File

@ -158,6 +158,8 @@ export const setUserDataWithPinCode = async (data) => {
export const updatePinCode = async (data) => {
let password = null;
let accessToken = null;
try {
await setPinCode(data.pinCode);
const users = await getUserData();
if (users.length > 0) {
users.forEach(async (userData) => {
@ -177,15 +179,13 @@ export const updatePinCode = async (data) => {
activeKey: encryptKey(privateKeys.active.toString(), data.pinCode),
memoKey: encryptKey(privateKeys.memo.toString(), data.pinCode),
};
const response = await updateUserData(updatedUserData);
const authData = {
isLoggedIn: true,
currentUsername: userData.username,
};
await setAuthStatus(authData);
return response;
await updateUserData(updatedUserData);
});
return true;
}
return false;
} catch (error) {
return Promise.reject(new Error('Unknown error, please contact to eSteem.'));
}
};