mirror of https://github.com/franjsco/tick3t
refactoring: remove unused state
This commit is contained in:
parent
65b0e665f3
commit
3d56240a3f
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue