Factor out clearStorageButton

pull/21833/head
David Baker 2018-04-30 14:22:18 +01:00
parent 5d46efc3e8
commit 54cccab0c7
1 changed files with 8 additions and 6 deletions

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>;
}