mytoons.ejs 1.48 KB
<!DOCTYPE html>
<html>
<head>
    <title>내툰</title>
    <link rel='stylesheet' href='/stylesheets/style.css' />
    <script src="http://developers.kakao.com/sdk/js/kakao.min.js"></script>
</head>
<h1>내툰</h1>
<p>추가한 리스트</p>
<a id="kakao-login-btn"></a>
<a id="kakao-logout-btn" href="javascript:logout();">로그아웃</a>
<a id="save_config">저장</a>


<table>
</table>
</br>

<script type='text/javascript'>
    //<![CDATA[
    // 사용할 앱의 JavaScript 키를 설정해 주세요.
    Kakao.init('602377cd7aa60a82eeebda466560f3e5');
    // 카카오 로그인 버튼을 생성합니다.
    Kakao.Auth.getStatus(function(statusObj){
        if(statusObj.status=='connected'){
            document.getElementById('kakao-login-btn').setAttribute('style','display: none;');
        }else{
            alert("로그인 해주세요!");
            location.href="/";
            document.getElementById('kakao-logout-btn').setAttribute('style','display: none;');
            document.getElementById('save_config').setAttribute('style','display: none;');
        }
    });

    Kakao.Auth.createLoginButton({
        container: '#kakao-login-btn',
        size:'small',
        success: function(authObj) {
            location.reload();
        },
        fail: function(err) {
            alert("로그인 실패!");
        }
    });

    function logout(){
        Kakao.Auth.logout(function () {
            location.reload();
        });

    }
    //]]>

</script>

</body>

</html>