Press n or j to go to the next uncovered block, b, p or k for the previous block.
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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | import React from 'react'; import {Button} from "primereact/button"; import {LoginControllerService} from "../generated/api"; /** * the {@link Header} properties */ type Props = { login: () => void; username: string; } type HeaderState = { } export class Header extends React.Component<Props, HeaderState> { constructor(props: Props) { super(props); this.state = { } } /** * quick and dirty implementation of logut. */ logout = () => { LoginControllerService.logout() .then((value: string) => {}) .catch(reason => {window.location.reload()}) } render() { return ( <div className="header flex flex-row justify-content-between"> <span className={'font-bold ml-2 my-auto title text-sm sm:text-xl'}>Task Management System</span> <div className={'flex flex-row login my-auto'}> <span className={'my-auto'}>{this.props.username}</span> <Button icon="pi pi-user" disabled={ this.props.username !== '' && this.props.username !== 'guest'} className="p-button-rounded p-button-info p-button-text login" onClick={this.props.login}/> {this.props.username !== 'guest' && <Button icon="pi pi-sign-out" className="p-button-rounded p-button-info p-button-text login" onClick={this.logout}/> } </div> </div>); } } |