mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
rm need for separate loading boolean in state
This commit is contained in:
parent
b779a9de45
commit
dc7325b7de
3 changed files with 21 additions and 24 deletions
BIN
src/FilterLists.Web.V2/package-lock.json
generated
BIN
src/FilterLists.Web.V2/package-lock.json
generated
Binary file not shown.
|
|
@ -38,4 +38,4 @@
|
|||
"last 1 safari version"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,32 +4,29 @@ import { nameof } from '../../utils';
|
|||
import { List } from './List';
|
||||
|
||||
interface State {
|
||||
data: List[];
|
||||
loading: boolean;
|
||||
data: List[];
|
||||
}
|
||||
|
||||
export class AllListsTable extends React.Component<{}, State> {
|
||||
constructor(props: any) {
|
||||
super(props);
|
||||
this.state = {
|
||||
data: [],
|
||||
loading: false,
|
||||
};
|
||||
}
|
||||
constructor(props: any) {
|
||||
super(props);
|
||||
this.state = {
|
||||
data: []
|
||||
};
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.setState({ loading: true });
|
||||
fetch("/api/v1/lists")
|
||||
.then(response => response.json())
|
||||
.then(json => { this.setState({ data: json, loading: false }); })
|
||||
}
|
||||
componentDidMount() {
|
||||
fetch("/api/v1/lists")
|
||||
.then(response => response.json())
|
||||
.then(json => { this.setState({ data: json }); })
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Table<List> dataSource={this.state.data} rowKey={record => record.id.toString()} loading={this.state.loading} size="small" pagination={{ position: "top", size: "small" }} >
|
||||
<Table.Column<List> title="Name" dataIndex={nameof<List>("name")} width={250} fixed="left" />
|
||||
<Table.Column<List> title="Description" dataIndex={nameof<List>("description")} />
|
||||
</Table>
|
||||
);
|
||||
}
|
||||
render() {
|
||||
return (
|
||||
<Table<List> dataSource={this.state.data} rowKey={record => record.id.toString()} loading={this.state.data.length > 0 ? false : true} size="small" pagination={{ position: "top", size: "small" }} >
|
||||
<Table.Column<List> title="Name" dataIndex={nameof<List>("name")} width={250} fixed="left" />
|
||||
<Table.Column<List> title="Description" dataIndex={nameof<List>("description")} />
|
||||
</Table>
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue