LoginwithSocial.js 2.3 KB
Newer Older
Spark's avatar
Spark committed
1
2
3
import React from 'react'
import '../App.css'
import { Form, Modal, Button, Row, Col, Image, Alert } from 'react-bootstrap';
Spark's avatar
Spark committed
4
import Oauth, { LoginWithKakao } from '../utils/Oauth';
5
6
7
import { useEffect } from 'react';
import axios from 'axios';
import { useState } from 'react';
Spark's avatar
Spark committed
8
9
10
11
12
13
14
15
16
17
18
19

function LoginwithSocial() {

    const inboxstyled = {
        display: 'flex',
        flexDirection: 'column',
        maxWidth: '100%',
        justifyContent: 'center',
        margin: 'auto',
        padding: '10px'
    }

Spark's avatar
Spark committed
20
    function loginWithKakao2() {
21
        window.Kakao.Auth.authorize({
Spark's avatar
Spark committed
22
23
24
25
26
27
28
29
30
            redirectUri: 'http://localhost:3000/oauth'
          })
        }

    // useEffect(()=> {
    //     window.location.replace('/')

    // },[localStorage.getItem('Kakao_token')])

31

Spark's avatar
Spark committed
32
    return (
33
34
        <Row className='m-auto'>
            <Modal.Header className='d-flex justify-content-center w-100'>
Spark's avatar
Spark committed
35
36
37
38
39
40
41
42
43
44
45
46
47
                <Modal.Title id="example-modal-sizes-title-sm">
                    LOGIN
                </Modal.Title>
            </Modal.Header>
            <Modal.Body>
                <Form style={inboxstyled}>
                    <Form.Group controlId="formBasicEmail">
                        <Form.Control type="email" placeholder="Email" />
                    </Form.Group>

                    <Form.Group controlId="formBasicPassword">
                        <Form.Control type="password" placeholder="Password" />
                    </Form.Group>
48
                    <Button variant='light' type="submit" id='formbtn'>
Spark's avatar
Spark committed
49
50
51
52
53
                        LOGIN
                    </Button>
                </Form>
                <hr />
                <Row style={{ margin: 'auto', marginBottom: '5px', display: 'flex', justifyContent: 'center' }}>
Spark's avatar
Spark committed
54
                    <a href="#" onClick={loginWithKakao2} id='socialLink' >
55
                        <img src='/images/Kakao1.jpg' id='logpng' />
Spark's avatar
Spark committed
56
57
                        KAKAO
                    </a>
Spark's avatar
Spark committed
58
59
                    <a href="#;" onClick={LoginWithKakao} id='socialLink' >
                        {/* 세미콜론이 붙으면 최상단 이동 x */}
60
61
62
                        <img src='/images/Kakao1.jpg' id='logpng' />
                        KAKAOHTML
                    </a>
Spark's avatar
Spark committed
63
                   
Spark's avatar
Spark committed
64
65
                </Row>
            </Modal.Body>
66
        </Row>
Spark's avatar
Spark committed
67
68
69
70
    )
}

export default LoginwithSocial;