Use react links.

This commit is contained in:
Yang Luo
2021-02-12 00:31:53 +08:00
parent 8790e95147
commit ee1e08ae20
5 changed files with 40 additions and 44 deletions

View File

@ -1,4 +1,5 @@
import React from "react";
import {Link} from "react-router-dom";
import {Button, Col, Popconfirm, Row, Table} from 'antd';
import moment from "moment";
import * as Setting from "./Setting";
@ -78,7 +79,9 @@ class UserListPage extends React.Component {
sorter: (a, b) => a.name.localeCompare(b.name),
render: (text, record, index) => {
return (
<a href={`/users/${text}`}>{text}</a>
<Link to={`/users/${text}`}>
{text}
</Link>
)
}
},
@ -135,7 +138,7 @@ class UserListPage extends React.Component {
render: (text, record, index) => {
return (
<div>
<Button style={{marginTop: '10px', marginBottom: '10px', marginRight: '10px'}} type="primary" onClick={() => Setting.goToLink(`/users/${record.name}`)}>Edit</Button>
<Button style={{marginTop: '10px', marginBottom: '10px', marginRight: '10px'}} type="primary" onClick={() => this.props.history.push(`/users/${record.name}`)}>Edit</Button>
<Popconfirm
title={`Sure to delete user: ${record.name} ?`}
onConfirm={() => this.deleteUser(index)}