correct accoount editing for incremental updates
This commit is contained in:
@@ -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));
|
||||
}
|
||||
|
||||
|
||||
@@ -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');
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user