Factor out clearStorageButton

This commit is contained in:
David Baker 2018-04-30 14:22:18 +01:00
parent 5d46efc3e8
commit 54cccab0c7

View file

@ -58,6 +58,12 @@ export default React.createClass({
const BaseDialog = sdk.getComponent('views.dialogs.BaseDialog');
const DialogButtons = sdk.getComponent('views.elements.DialogButtons');
const clearStorageButton = (
<button onClick={this._onClearStorageClick} className="danger">
{ _t("Clear Storage and Sign Out") }
</button>
);
let dialogButtons;
if (SdkConfig.get().bug_report_endpoint_url) {
dialogButtons = <DialogButtons primaryButton={_t("Send Logs")}
@ -65,9 +71,7 @@ export default React.createClass({
focus={true}
hasCancel={false}
>
<button onClick={this._onClearStorageClick} className="danger">
{ _t("Clear Storage and Sign Out") }
</button>
{clearStorageButton}
</DialogButtons>;
} else {
dialogButtons = <DialogButtons primaryButton={_t("Refresh")}
@ -75,9 +79,7 @@ export default React.createClass({
focus={true}
hasCancel={false}
>
<button onClick={this._onClearStorageClick} className="danger">
{ _t("Clear Storage and Sign Out") }
</button>
{clearStorageButton}
</DialogButtons>;
}