49 lines
1.3 KiB
JavaScript
49 lines
1.3 KiB
JavaScript
import {Link} from "react-router-dom";
|
|
import React, {Component} from "react";
|
|
import './Style.css'
|
|
import SearchStudent from "./SearchStudent";
|
|
|
|
class ChoixDept extends Component {
|
|
constructor(props) {
|
|
super(props);
|
|
this.state = {
|
|
depts: [],
|
|
};
|
|
}
|
|
|
|
componentWillMount() {
|
|
let BASE_URL = window.$api_url
|
|
fetch(BASE_URL + 'list_depts?format=json', {
|
|
method: 'GET',
|
|
verify: false,
|
|
credentials: 'include',
|
|
})
|
|
.then(response =>
|
|
response.json().then(data => ({
|
|
data: data,
|
|
status: response.status
|
|
})
|
|
).then(res => {
|
|
this.setState({ depts: res.data })
|
|
}));
|
|
}
|
|
|
|
render() {
|
|
return (
|
|
<div className="wrapper">
|
|
<h1>Choix du département</h1>
|
|
{this.state.depts.map((dept, index) => {
|
|
return (
|
|
<div id="wrapDept">
|
|
<Link to={`/${dept}/Scolarite`}>
|
|
Département {dept}
|
|
</Link>
|
|
</div>
|
|
)
|
|
},)}
|
|
</div>
|
|
);
|
|
}
|
|
}
|
|
|
|
export default ChoixDept |