File tree Expand file tree Collapse file tree 1 file changed +3
-6
lines changed Expand file tree Collapse file tree 1 file changed +3
-6
lines changed Original file line number Diff line number Diff line change 9
9
var match = RegExp ( '[#&]access_token=([^&]*)' ) . exec ( window . location . hash ) ;
10
10
var accessToken = match && decodeURIComponent ( match [ 1 ] . replace ( / \+ / g, ' ' ) ) ;
11
11
if ( ! accessToken ) {
12
- redirectUri = document . location . href ;
13
- url = 'https://' + domain + '/authorize?audience=' + audience + '&response_type=token&client_id=' + clientId + '&redirect_uri=' + redirectUri ;
14
- document . location = url ;
12
+ document . location = 'https://' + domain + '/authorize?audience=' + audience + '&response_type=token&client_id=' + clientId + '&redirect_uri=' + document . location . href ;
15
13
} else {
16
14
document . location . hash = '' ;
17
- url = '/api.php/records/posts?join=categories&join=tags&join=comments&filter=id,eq,1' ;
18
15
var req = new XMLHttpRequest ( ) ;
19
16
req . onreadystatechange = function ( ) {
20
17
if ( req . readyState == 4 ) {
21
18
console . log ( req . responseText ) ;
22
- jsonObject = JSON . parse ( req . responseText ) ;
23
- document . getElementById ( 'output' ) . innerHTML = JSON . stringify ( jsonObject , undefined , 4 ) ;
19
+ document . getElementById ( 'output' ) . innerHTML = JSON . stringify ( JSON . parse ( req . responseText ) , undefined , 4 ) ;
24
20
}
25
21
}
22
+ url = '/api.php/records/posts?join=categories&join=tags&join=comments&filter=id,eq,1' ;
26
23
req . open ( "GET" , url , true ) ;
27
24
req . setRequestHeader ( 'X-Authorization' , 'Bearer ' + accessToken ) ;
28
25
req . send ( ) ;
You can’t perform that action at this time.
0 commit comments