Moved rendering of OAuth info inside the condition for access token

This commit is contained in:
jperez 2014-07-01 09:48:10 +02:00
parent 1c48876015
commit 2d9c7ac1f7

View file

@ -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();
} }