made userDataStore

This commit is contained in:
Daria Golova
2022-06-29 18:34:42 +03:00
parent bcfc018560
commit 1c539e5255
3 changed files with 56 additions and 7 deletions

View File

@@ -0,0 +1,24 @@
import { cryptography } from "@liskhq/lisk-client";
import { makeAutoObservable, reaction } from "mobx";
import { registrationStore } from './store';
class UserDataStore{
_data = []
constructor() {
makeAutoObservable(this);
reaction(() => ({data: registrationStore.userData}), ({data}) => {
this._data = data.data;
})
}
get userData(){
return this._data.map((elem) => ({
...elem,
value: cryptography.decryptMessageWithPassphrase(elem.value, elem.value_nonce, registrationStore.passPhrase, registrationStore.pubKey)
}))
}
}
export const userDataStore = new UserDataStore();