61 lines
2.3 KiB
JavaScript
61 lines
2.3 KiB
JavaScript
import React, {Component} from "react";
|
|
import {Nav, Navbar, Button, Container} from 'react-bootstrap'
|
|
import { Redirect } from 'react-router-dom';
|
|
import './Style.css'
|
|
|
|
/** Barre de navigation */
|
|
class ScoNavBar extends Component {
|
|
constructor(props) {
|
|
super(props);
|
|
this.state = {
|
|
logout: false
|
|
};
|
|
}
|
|
|
|
logout() {
|
|
let BASE_URL = window.$api_url
|
|
|
|
fetch(BASE_URL + "acl_users/logout")
|
|
.then(res => {this.setState({logout: true})})
|
|
.catch(console.log)
|
|
}
|
|
|
|
render() {
|
|
return (
|
|
<Navbar bg="light" expand="sm">
|
|
<Container>
|
|
<Navbar.Brand href={window.$api_url + "static/mobile/"}>
|
|
<img
|
|
alt="ScodocLogo"
|
|
src="/ScoDoc/static/icons/scologo_img.png"
|
|
width="20"
|
|
height="30"
|
|
className="d-inline-block align-top"
|
|
/>{' '}
|
|
ScoDoc
|
|
</Navbar.Brand>
|
|
<Navbar.Toggle aria-controls="basic-navbar-nav" />
|
|
<Navbar.Collapse id="basic-navbar-nav">
|
|
<Nav className="ml-auto">
|
|
<Button variant="outline-primary" href="/ScoDoc" style={{"margin": "1px"}}>Version Desktop</Button>
|
|
{window.location.href.split('/').length > 9 &&
|
|
<Button
|
|
variant="outline-primary"
|
|
href={"/ScoDoc/static/mobile/#/" + window.location.href.split('/')[7] + "/Scolarite"}
|
|
style={{"margin": "1px"}}>
|
|
Retour au choix de semestre
|
|
</Button>
|
|
}
|
|
<Button variant="primary" style={{"margin": "1px"}} onClick={() => {this.logout()}}>Déconnexion</Button>
|
|
</Nav>
|
|
</Navbar.Collapse>
|
|
</Container>
|
|
{this.state.logout === true &&
|
|
<Redirect push to="/"/>
|
|
}
|
|
</Navbar>
|
|
)
|
|
}
|
|
}
|
|
|
|
export default ScoNavBar |