Skip to content

Commit 6807387

Browse files
author
Emmanouil Konstantinidis
committed
Save token
1 parent b53de84 commit 6807387

File tree

3 files changed

+20
-8
lines changed

3 files changed

+20
-8
lines changed

rest_framework_docs/static/rest_framework_docs/js/components/response.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,16 @@ var Response = React.createClass({
1010
};
1111
},
1212

13+
saveToken: function () {
14+
window.token = 'Token ' + this.props.payload.body.token;
15+
console.log('Token ' + this.props.payload.body.token);
16+
},
17+
1318
render: function () {
1419
if (!this.props.payload) {
1520
return (
1621
<div>
17-
<h3>Response <span className='label status-code pull-right'></span></h3>
22+
<h3>Response</h3>
1823
<p className='lead text-center'>Awaiting request...</p>
1924
</div>
2025
);
@@ -35,7 +40,10 @@ var Response = React.createClass({
3540

3641
{hasToken ? (
3742
<div className='well well-default text-center'>
38-
<button className='btn btn-sm btn-info'><i className='fa fa-key'></i> Save Token</button>
43+
<button className='btn btn-sm btn-info' onClick={this.saveToken}>
44+
<i className='fa fa-key' />
45+
Save Token
46+
</button>
3947
<h6>Your token will be lost when you refresh the page.</h6>
4048
</div>
4149
) : null}

rest_framework_docs/static/rest_framework_docs/js/dist.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31128,6 +31128,11 @@ var Response = React.createClass({
3112831128
};
3112931129
},
3113031130

31131+
saveToken: function saveToken() {
31132+
window.token = 'Token ' + this.props.payload.body.token;
31133+
console.log('Token ' + this.props.payload.body.token);
31134+
},
31135+
3113131136
render: function render() {
3113231137
if (!this.props.payload) {
3113331138
return React.createElement(
@@ -31136,8 +31141,7 @@ var Response = React.createClass({
3113631141
React.createElement(
3113731142
'h3',
3113831143
null,
31139-
'Response ',
31140-
React.createElement('span', { className: 'label status-code pull-right' })
31144+
'Response'
3114131145
),
3114231146
React.createElement(
3114331147
'p',
@@ -31191,9 +31195,9 @@ var Response = React.createClass({
3119131195
{ className: 'well well-default text-center' },
3119231196
React.createElement(
3119331197
'button',
31194-
{ className: 'btn btn-sm btn-info' },
31198+
{ className: 'btn btn-sm btn-info', onClick: this.saveToken },
3119531199
React.createElement('i', { className: 'fa fa-key' }),
31196-
' Save Token'
31200+
'Save Token'
3119731201
),
3119831202
React.createElement(
3119931203
'h6',
@@ -31248,7 +31252,7 @@ module.exports = {
3124831252

3124931253
prettyPrint: function prettyPrint(obj) {
3125031254
var jsonLine = /^( *)("[\w]+": )?("[^"]*"|[\w.+-]*)?([,[{])?$/mg;
31251-
return JSON.stringify(obj, null, 3).replace(/&/g, '&amp;').replace(/\\"/g, '&quot;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(jsonLine, this.replacer);
31255+
return JSON.stringify(obj, null, 2).replace(/&/g, '&amp;').replace(/\\"/g, '&quot;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(jsonLine, this.replacer);
3125231256
}
3125331257

3125431258
};

rest_framework_docs/static/rest_framework_docs/js/utils/jsonpp.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ module.exports = {
1515

1616
prettyPrint: function (obj) {
1717
var jsonLine = /^( *)("[\w]+": )?("[^"]*"|[\w.+-]*)?([,[{])?$/mg;
18-
return JSON.stringify(obj, null, 3)
18+
return JSON.stringify(obj, null, 2)
1919
.replace(/&/g, '&amp;').replace(/\\"/g, '&quot;')
2020
.replace(/</g, '&lt;').replace(/>/g, '&gt;')
2121
.replace(jsonLine, this.replacer);

0 commit comments

Comments
 (0)