KakaoLogin.js 841 Bytes
import { makeStyles } from '@material-ui/core/styles';
import TextField from '@material-ui/core/TextField';
import React from 'react';
import path from 'path';
require("dotenv").config({
  path : path.join(__dirname,'/jaksimsamil-server/.env')
});
console.log(process.env.KAKAO_JS_KEY);

const useStyles = makeStyles((theme) => ({
  root: {
    '& > *': {
      margin: theme.spacing(1),
    },
  },
  button: {
    margin: theme.spacing(1),
  },
}));

const KakaoLoginBtn = () => {
  const classes = useStyles();
  const kakaoLogin = function() {
    window.Kakao.Auth.login({
      success:function(auth) {
        console.log(auth);
      },
      fail:function(err) {
        console.log(err);
      }
    })
  }
  return (
    <div>
      <button onClick={kakaoLogin}>KakaoLogin</button>
    </div>
  );
};

export default KakaoLoginBtn