Skip to content

Commit

Permalink
refactor: replace history.push with link tag #4
Browse files Browse the repository at this point in the history
  • Loading branch information
jsers committed Mar 29, 2023
1 parent 06d8ce4 commit 37c32a3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
9 changes: 7 additions & 2 deletions src/pages/dashboard/List/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,14 @@ export default function index() {
className: 'name-column',
render: (text: string, record: DashboardType) => {
return (
<div className='table-active-text' onClick={() => history.push(`/dashboards/${record.ident || record.id}`)}>
<Link
className='table-active-text'
to={{
pathname: `/dashboards/${record.ident || record.id}`,
}}
>
{text}
</div>
</Link>
);
},
},
Expand Down
12 changes: 6 additions & 6 deletions src/pages/warning/shield/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { CloseCircleOutlined, ExclamationCircleOutlined, SearchOutlined } from '
import dayjs from 'dayjs';
import _ from 'lodash';
import { useTranslation } from 'react-i18next';
import { useHistory, useLocation } from 'react-router-dom';
import { useHistory, useLocation, Link } from 'react-router-dom';
import queryString from 'query-string';
import AdvancedWrap from '@/components/AdvancedWrap';
import PageLayout from '@/components/pageLayout';
Expand Down Expand Up @@ -86,14 +86,14 @@ const Shield: React.FC = () => {
dataIndex: 'note',
render: (data, record: any) => {
return (
<div
className='table-active-text'
onClick={() => {
history.push(`/alert-mutes/edit/${record.id}`, record);
<Link
to={{
pathname: `/alert-mutes/edit/${record.id}`,
state: record,
}}
>
{data}
</div>
</Link>
);
},
},
Expand Down

0 comments on commit 37c32a3

Please sign in to comment.