From ab695d29fe08f97a3e9f87f161ff2c7d7fa51dc1 Mon Sep 17 00:00:00 2001 From: Gazook89 <58999374+Gazook89@users.noreply.github.com> Date: Wed, 28 Sep 2022 11:13:16 -0500 Subject: [PATCH] refactor into `handle...` and `render...` methods --- client/homebrew/pages/editPage/editPage.jsx | 23 +++++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/client/homebrew/pages/editPage/editPage.jsx b/client/homebrew/pages/editPage/editPage.jsx index 746f5324b..fa755aa5d 100644 --- a/client/homebrew/pages/editPage/editPage.jsx +++ b/client/homebrew/pages/editPage/editPage.jsx @@ -344,6 +344,19 @@ const EditPage = createClass({ } }, + handleAutoSave : function(){ + this.setState((prevState)=>({ + autoSave : !prevState.autoSave + })); + localStorage.setItem('AUTOSAVE_ON', JSON.stringify(!this.state.autoSave)); + }, + + renderAutoSaveButton : function(){ + return + Autosave + ; + }, + processShareId : function() { return this.state.brew.googleId && !this.state.brew.stubbed ? this.state.brew.googleId + this.state.brew.shareId : @@ -384,15 +397,7 @@ const EditPage = createClass({ {this.renderGoogleDriveIcon()} {this.renderSaveButton()} - { - this.setState((prevState)=>({ - autoSave : !prevState.autoSave - })); - localStorage.setItem('AUTOSAVE_ON', JSON.stringify(!this.state.autoSave)); - }}> - Autosave - - + {this.renderAutoSaveButton()}