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 = {
|
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"
|
||||||
|
|
Loading…
Reference in New Issue