Browse Source

Use react router to rerender page

master
Garrit Franke 4 years ago
parent
commit
096a76fb42
  1. 15
      client/src/pages/ClientPage.js

15
client/src/pages/ClientPage.js

@ -1,20 +1,13 @@
import React, { useState, useEffect } from "react";
import {
Select,
Tag,
Space,
List,
Typography,
Statistic,
Row,
Col,
} from "antd";
import { Select, Tag, Space, List, Typography, Row, Col } from "antd";
import { useHistory } from "react-router";
import ClientService from "../service/ClientService";
import StatusTimeline from "../components/StatusTimeline";
export default function ClientPage({ id }) {
const [client, setClient] = useState({});
const history = useHistory();
useEffect(() => {
ClientService.getClientById(id).then((client) => {
@ -26,7 +19,7 @@ export default function ClientPage({ id }) {
const updateStatus = (value) => {
ClientService.updateStatus(client.id, value).then(() => {
setClient({ ...client, status: value });
window.location.reload();
history.go(0);
});
};

Loading…
Cancel
Save