From 61637500605cbf12c7c5a6fb708f13f922d54f53 Mon Sep 17 00:00:00 2001 From: Jasper Huang Date: Fri, 15 Oct 2021 11:00:09 -0700 Subject: [PATCH] Update local values and queue API request in background --- src/pages/workspace/WorkspaceSettingsPage.js | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/pages/workspace/WorkspaceSettingsPage.js b/src/pages/workspace/WorkspaceSettingsPage.js index 53db39638bff..acd9087b8fdd 100644 --- a/src/pages/workspace/WorkspaceSettingsPage.js +++ b/src/pages/workspace/WorkspaceSettingsPage.js @@ -105,19 +105,16 @@ class WorkspaceSettingsPage extends React.Component { } submit() { - Policy.updateLocalPolicyValues(this.props.policy.id, {isPolicyUpdating: true}); + const name = this.state.name.trim(); + const avatarURL = this.state.avatarURL; + const outputCurrency = this.state.currency; + Policy.updateLocalPolicyValues(this.props.policy.id, {name, avatarURL, outputCurrency}); // Wait for the upload avatar promise to finish before updating the policy this.uploadAvatarPromise.then(() => { - const name = this.state.name.trim(); - const avatarURL = this.state.avatarURL; - const policyID = this.props.policy.id; - const currency = this.state.currency; - - Policy.update(policyID, {name, avatarURL, outputCurrency: currency}, true); - }).catch(() => { - Policy.updateLocalPolicyValues(this.props.policy.id, {isPolicyUpdating: false}); + Policy.update(this.props.policy.id, {name, avatarURL, outputCurrency}); }); + Growl.success(this.props.translate('workspace.common.growlMessageOnSave')); } render() {