Fakultas Ilmu Komputer UI

VacancyPage.jsx 1.25 KB
Newer Older
1
2
3
4
import React from 'react';
import Tabs from './components/Tabs';
import Pane from './components/Pane';
import VacancyList from './components/VacancyList';
5
import Server from './lib/Server';
6
7
8
9
10
11

export default class VacancyPage extends React.Component {

  constructor(props) {
    super(props);
    /* istanbul ignore next */
12
13
14
15
16
17
    this.state = {
      email: '',
      password: '',
      errorFlag: false,
      vacancies: []
    };
18
19
20
21
22
    this.handleItemClick = this.handleItemClick.bind(this);
  }

  handleItemClick = (e, { name }) => this.setState({ activeItem: name });

23
24
25
26
27
28
29
  fetchVacancies(url) {
    Server.get(url).then((data) => {
      this.setState({ vacancies: data });
    }, () => {
    });
  }

30
  render() {
31
32
    const data = [{ data1: 'val1' }, { data1: 'val2' }];

33
    return (<div>
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
      <Tabs selected={0}>
        <Pane label="Semua Lowongan" >
          <VacancyList vacancies={data} />
          { this.fetchVacancies('/api') }
        </Pane>
        <Pane label="Lamaran saya" >
          <VacancyList vacancies={data} />
          { this.fetchVacancies('/api') }
        </Pane>
        <Pane label="Lamaran Ditandai" >
          <VacancyList vacancies={data} />
          { this.fetchVacancies('/api') }
        </Pane>
      </Tabs>
    </div>
49
50

    );
51
  }
52
}