๐Ÿ“ฆ chaokunyang / amanda

๐Ÿ“„ Logout.js ยท 32 lines
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32import React, { Component } from 'react';
import Http from '../http/Http'

class Logout extends Component {

    constructor(props){
        super(props);
        this.handleSubmit = this.handleSubmit.bind(this);
    }

    handleSubmit(event) {
        event.preventDefault();


        Http.post('/logout')
            .then(response => document.location.href = "/")
            .catch(error => {
                console.log(error);
        });
    }

    render() {
        return (
            <form onSubmit={this.handleSubmit}>
                <button type="submit" className="btn btn-default">้€€ๅ‡บ็™ปๅฝ•</button>
            </form>
        )
    }

}

export default Logout