refactoring: remove unused state

This commit is contained in:
Francesco Esposito 2019-08-03 16:50:26 +02:00
parent 65b0e665f3
commit 3d56240a3f
1 changed files with 3 additions and 10 deletions

View File

@ -13,22 +13,19 @@ class ViewTicket extends Component {
this.state = { this.state = {
data: '', data: '',
error: '', error: '',
isLoading: false,
}; };
} }
componentDidMount() { componentDidMount() {
this.setState({ isLoading: true });
const { match: { params } } = this.props; const { match: { params } } = this.props;
viewTicket(params.ticketId) viewTicket(params.ticketId)
.then((json) => this.setState({ data: json.data, isLoading: false })) .then(json => this.setState({ data: json.data}))
.catch(error => this.setState({ error, isLoading: false })); .catch(error => this.setState({ error}));
} }
render() { render() {
const { data, isLoading, error } = this.state; const { data, error } = this.state;
if (error) { if (error) {
return ( return (
@ -41,10 +38,6 @@ class ViewTicket extends Component {
) )
} }
if (isLoading) {
return '' // add spinner
}
return ( return (
<Card <Card
title="View Ticket" title="View Ticket"