1
0
mirror of https://github.com/franjsco/tick3t synced 2025-06-05 22:19:18 +02:00

refactoring: remove unused state

This commit is contained in:
Francesco Esposito
2019-08-03 16:50:26 +02:00
parent 65b0e665f3
commit 3d56240a3f

View File

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