diff options
| author | jackyzha0 <[email protected]> | 2020-05-16 22:42:48 -0700 |
|---|---|---|
| committer | jackyzha0 <[email protected]> | 2020-05-16 22:42:48 -0700 |
| commit | 712bf925f8ae84a5a2fee87b8aa3c969df48fd50 (patch) | |
| tree | 839a68fe0c96e313a896d0cf0300523da275fac0 /frontend/src/components/ViewPaste.js | |
| parent | Merge pull request #26 from jackyzha0/raw-button (diff) | |
| download | ctrl-v-712bf925f8ae84a5a2fee87b8aa3c969df48fd50.tar.xz ctrl-v-712bf925f8ae84a5a2fee87b8aa3c969df48fd50.zip | |
allow language saving
Diffstat (limited to 'frontend/src/components/ViewPaste.js')
| -rw-r--r-- | frontend/src/components/ViewPaste.js | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/frontend/src/components/ViewPaste.js b/frontend/src/components/ViewPaste.js index 0b2ebe7..81d78f3 100644 --- a/frontend/src/components/ViewPaste.js +++ b/frontend/src/components/ViewPaste.js @@ -34,7 +34,6 @@ class ViewPaste extends React.Component { handleChange(event) { const target = event.target; const name = target.name; - console.log(target, name) this.setState({ [name]: target.value @@ -96,8 +95,8 @@ class ViewPaste extends React.Component { lang={this.state.language} theme={this.state.theme} onChange={this.handleChange} + err={<Error ref={this.ErrorLabel} />} expiry={this.state.expiry} /> - <Error ref={this.ErrorLabel} /> </div> ); } @@ -109,9 +108,11 @@ class ViewPaste extends React.Component { } setStateFromData(data) { + console.log(data) this.setState({ title: data.title, content: data.content, + language: data.language, expiry: this.fmtDateStr(data.expiry), }) } @@ -124,6 +125,12 @@ class ViewPaste extends React.Component { }).catch((error) => { const resp = error.response + // network err + if (!resp) { + this.ErrorLabel.current.showMessage(error) + return + } + // catch 401 unauth (password protected) if (resp.status === 401) { this.setState({hasPass: true}) |