Fakultas Ilmu Komputer UI

TopMenu.jsx 1.22 KB
Newer Older
1
2
import React from 'react';
import { Menu, Image } from 'semantic-ui-react';
3
4
import { Link, browserHistory } from 'react-router';

5
import Server from '../lib/Server';
6
import Storage from '../lib/Storage';
7
8

export default class TopMenu extends React.Component {
9
<<<<<<< HEAD
10
  state = { activeItem: 'home' };
sirinbaisa's avatar
sirinbaisa committed
11
    handleItemClick = (e, { name }) => this.setState({ activeItem: name })
12
  render() {
sirinbaisa's avatar
sirinbaisa committed
13
    const { activeItem } = this.state;
14
=======
15
16
17
18
19
  constructor(props) {
    super(props);
    /* istanbul ignore next */
    this.logout = this.logout.bind(this);
  }
sirinbaisa's avatar
sirinbaisa committed
20

21
22
23
24
25
26
  logout = () => {
    Server.get('/api-auth/logout/?next=/', true).then(() => {
      Storage.clear();
      browserHistory.push('/login');
    });
  };
27
>>>>>>> 83ea6c3d4376e9644af1ae3104de3d496ee20b98
28

29
30
  render() {
    return (
31
      <Menu color="blue" pointing secondary>
32
33
        <Image as="a" size="small" src="/assets/img/logo.png" href="/" />
        <Menu.Menu position="right">
34
35
          <Menu.Item as={Link} to="/lowongan" name="home" onClick={this.handleItemClick} />
          <Menu.Item as={Link} to="/profile" name="profil" onClick={this.handleItemClick} />
Zamil Majdy's avatar
Zamil Majdy committed
36
          <Menu.Item as={Link} onClick={this.logout} name="logout" />
37
38
39
40
41
        </Menu.Menu>
      </Menu>
    );
  }
}