Skip to content

Commit

Permalink
6.API 이용
Browse files Browse the repository at this point in the history
  • Loading branch information
egoing committed Aug 26, 2018
1 parent 7a41615 commit 2156381
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions index.html
Expand Up @@ -8,12 +8,16 @@
<script>
function checkLoginStatus(){
var loginBtn = document.querySelector('#loginBtn');
var nameTxt = document.querySelector('#name');
if(gauth.isSignedIn.get()){
console.log('logined');
loginBtn.value = 'Logout';
var profile = gauth.currentUser.get().getBasicProfile();
nameTxt.innerHTML = 'Welcome <strong>'+profile.getName()+'</strong> ';
} else {
console.log('logouted');
loginBtn.value = 'Login';
nameTxt.innerHTML = '';
}
}
function init(){
Expand All @@ -34,9 +38,11 @@
</script>
</head>
<body>
<input type="button" id="loginBtn" value="checking..." onclick="
<span id="name"></span><input type="button" id="loginBtn" value="checking..." onclick="
if(this.value === 'Login'){
gauth.signIn().then(function(){
gauth.signIn({
scope:'https://www.googleapis.com/auth/calendar'
}).then(function(){
console.log('gauth.signIn()');
checkLoginStatus();
});
Expand Down

0 comments on commit 2156381

Please sign in to comment.