From 1519c913241669b532d13351331e7a8d512e1438 Mon Sep 17 00:00:00 2001 From: jackyzha0 Date: Fri, 17 Jul 2020 22:29:38 -0700 Subject: refactor renderers --- frontend/src/components/ViewPaste.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'frontend/src/components/ViewPaste.js') diff --git a/frontend/src/components/ViewPaste.js b/frontend/src/components/ViewPaste.js index 117bb18..6bff4ae 100644 --- a/frontend/src/components/ViewPaste.js +++ b/frontend/src/components/ViewPaste.js @@ -52,7 +52,7 @@ class ViewPaste extends React.Component { this.setState({ isRenderMode: !this.state.isRenderMode }); } - validatePass(pass) { + validatePass(pass, onErrorCallBack) { FetchPasswordPaste(this.props.hash, pass) .then((response) => { this.setState({ validPass: true }) @@ -62,19 +62,17 @@ class ViewPaste extends React.Component { // 401 unauth (bad pass) if (resp.status === 401) { - this.PasswordModal.current - .ErrorLabel.current - .showMessage("incorrect pass") + onErrorCallBack("incorrect pass") return } // otherwise, just log it lmao if (resp !== undefined) { const errTxt = `${resp.status}: ${resp.data}` - this.ErrorLabel.current.showMessage(errTxt) + onErrorCallBack(errTxt) } else { // some weird err (e.g. network) - this.ErrorLabel.current.showMessage(error) + onErrorCallBack(error) } }); } -- cgit v1.2.3