diff options
| author | jackyzha0 <[email protected]> | 2020-07-17 22:29:38 -0700 |
|---|---|---|
| committer | jackyzha0 <[email protected]> | 2020-07-17 22:29:38 -0700 |
| commit | 1519c913241669b532d13351331e7a8d512e1438 (patch) | |
| tree | f932ae156fdfdfc439ca51c67210e21b9fafb2dc /frontend/src/components/ViewPaste.js | |
| parent | refactor decorators (diff) | |
| download | ctrl-v-1519c913241669b532d13351331e7a8d512e1438.tar.xz ctrl-v-1519c913241669b532d13351331e7a8d512e1438.zip | |
refactor renderers
Diffstat (limited to 'frontend/src/components/ViewPaste.js')
| -rw-r--r-- | frontend/src/components/ViewPaste.js | 10 |
1 files changed, 4 insertions, 6 deletions
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) } }); } |