Moved rendering of OAuth info inside the condition for access token
This commit is contained in:
parent
1c48876015
commit
2d9c7ac1f7
1 changed files with 7 additions and 5 deletions
|
@ -95,12 +95,13 @@
|
||||||
if (error) {
|
if (error) {
|
||||||
alert('There was an error during the authentication');
|
alert('There was an error during the authentication');
|
||||||
} else {
|
} else {
|
||||||
oauthPlaceholder.innerHTML = oauthTemplate({
|
|
||||||
access_token: access_token,
|
|
||||||
refresh_token: refresh_token
|
|
||||||
});
|
|
||||||
|
|
||||||
if (access_token) {
|
if (access_token) {
|
||||||
|
// render oauth info
|
||||||
|
oauthPlaceholder.innerHTML = oauthTemplate({
|
||||||
|
access_token: access_token,
|
||||||
|
refresh_token: refresh_token
|
||||||
|
});
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: 'https://api.spotify.com/v1/me',
|
url: 'https://api.spotify.com/v1/me',
|
||||||
headers: {
|
headers: {
|
||||||
|
@ -114,6 +115,7 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
// render initial screen
|
||||||
$('#login').show();
|
$('#login').show();
|
||||||
$('#loggedin').hide();
|
$('#loggedin').hide();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue