mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-23 05:13:04 +03:00
Changed updatePinCode function with new structure
This commit is contained in:
parent
b60aa8be4a
commit
7a329d5ceb
@ -158,6 +158,8 @@ export const setUserDataWithPinCode = async (data) => {
|
|||||||
export const updatePinCode = async (data) => {
|
export const updatePinCode = async (data) => {
|
||||||
let password = null;
|
let password = null;
|
||||||
let accessToken = null;
|
let accessToken = null;
|
||||||
|
try {
|
||||||
|
await setPinCode(data.pinCode);
|
||||||
const users = await getUserData();
|
const users = await getUserData();
|
||||||
if (users.length > 0) {
|
if (users.length > 0) {
|
||||||
users.forEach(async (userData) => {
|
users.forEach(async (userData) => {
|
||||||
@ -177,15 +179,13 @@ export const updatePinCode = async (data) => {
|
|||||||
activeKey: encryptKey(privateKeys.active.toString(), data.pinCode),
|
activeKey: encryptKey(privateKeys.active.toString(), data.pinCode),
|
||||||
memoKey: encryptKey(privateKeys.memo.toString(), data.pinCode),
|
memoKey: encryptKey(privateKeys.memo.toString(), data.pinCode),
|
||||||
};
|
};
|
||||||
const response = await updateUserData(updatedUserData);
|
await updateUserData(updatedUserData);
|
||||||
const authData = {
|
|
||||||
isLoggedIn: true,
|
|
||||||
currentUsername: userData.username,
|
|
||||||
};
|
|
||||||
|
|
||||||
await setAuthStatus(authData);
|
|
||||||
return response;
|
|
||||||
});
|
});
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
} catch (error) {
|
||||||
|
return Promise.reject(new Error('Unknown error, please contact to eSteem.'));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user