diff --git a/frontend/my/src/Dashboard.js b/frontend/my/src/Dashboard.js index f899e64..20c6e68 100644 --- a/frontend/my/src/Dashboard.js +++ b/frontend/my/src/Dashboard.js @@ -1,4 +1,4 @@ -import { Col, Row, notification, Card, Tooltip, Icon } from "antd" +import { Col, Row, notification, Card, Tooltip, Icon, Spin } from "antd" import React from "react"; import { Chart, Axis, Geom, Tooltip as BizTooltip } from 'bizcharts'; @@ -6,18 +6,19 @@ import * as cs from "./constants" class Dashboard extends React.PureComponent { state = { - stats: null + stats: null, + loading: true } campaignTypes = ["running", "finished", "paused", "draft", "scheduled", "cancelled"] componentDidMount = () => { this.props.pageTitle("Dashboard") - this.props.request(cs.Routes.GetDashboarcStats, cs.MethodGet).then((resp) => { - this.setState({ stats: resp.data.data }) + this.setState({ stats: resp.data.data, loading: false }) }).catch(e => { notification["error"]({ message: "Error", description: e.message }) + this.setState({ loading: false }) }) } @@ -30,6 +31,7 @@ class Dashboard extends React.PureComponent {

Welcome


+ { this.state.stats &&
@@ -120,6 +122,7 @@ class Dashboard extends React.PureComponent {
} +
); }