correct accoount editing for incremental updates

This commit is contained in:
or-else
2019-02-04 13:05:03 +03:00
parent a534387593
commit 160e2574d4
2 changed files with 10 additions and 3 deletions
+2 -2
View File
@@ -9,13 +9,13 @@ export default class LocalStorageUtil {
// Get stored object.
static getObject(key) {
let value = localStorage.getItem(key);
const value = localStorage.getItem(key);
return value && JSON.parse(value);
}
// Partially or wholly update stored object.
static updateObject(key, value) {
let oldVal = this.getObject(key);
const oldVal = this.getObject(key);
this.setObject(key, Object.assign(oldVal || {}, value));
}
+8 -1
View File
@@ -751,7 +751,14 @@ class TinodeWeb extends React.Component {
handleUpdateAccountRequest(password, pub, defacs) {
if (pub || defacs) {
this.tinode.getMeTopic().setMeta({desc: {public: pub, defacs: defacs}}).catch((err) => {
const params = {};
if (pub) {
params.public = pub;
}
if (defacs) {
params.defacs = defacs;
}
this.tinode.getMeTopic().setMeta({desc: params}).catch((err) => {
this.handleError(err.message, 'err');
});
}