From 7da634e7727033bea4e88305fba30396c02bdbc3 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Sat, 19 Dec 2020 22:49:11 +0100 Subject: [PATCH] Fixed tags filtering from overview page --- src/servers/Overview.tsx | 10 ++++++++-- src/short-urls/ShortUrlsTable.tsx | 2 +- src/short-urls/helpers/ShortUrlsRow.tsx | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/servers/Overview.tsx b/src/servers/Overview.tsx index f6dd424e..03803036 100644 --- a/src/servers/Overview.tsx +++ b/src/servers/Overview.tsx @@ -1,6 +1,6 @@ import { FC, useEffect } from 'react'; import { Card, CardBody, CardHeader, CardText, CardTitle } from 'reactstrap'; -import { Link } from 'react-router-dom'; +import { Link, useHistory } from 'react-router-dom'; import { ShortUrlsListParams } from '../short-urls/reducers/shortUrlsListParams'; import { ShortUrlsList as ShortUrlsListState } from '../short-urls/reducers/shortUrlsList'; import { prettify } from '../utils/helpers/numbers'; @@ -40,6 +40,7 @@ export const Overview = ( const { loading: loadingTags } = tagsList; const { loading: loadingVisits, visitsCount } = visitsOverview; const serverId = isServerWithId(selectedServer) ? selectedServer.id : ''; + const history = useHistory(); useEffect(() => { listShortUrls({ itemsPerPage: 5, orderBy: { dateCreated: 'DESC' } }); @@ -95,7 +96,12 @@ export const Overview = ( See all » - + tags?.[0] && history.push(`/server/${serverId}/list-short-urls/1?tag=${tags[0]}`)} + /> diff --git a/src/short-urls/ShortUrlsTable.tsx b/src/short-urls/ShortUrlsTable.tsx index 55351166..4840ef6a 100644 --- a/src/short-urls/ShortUrlsTable.tsx +++ b/src/short-urls/ShortUrlsTable.tsx @@ -12,7 +12,7 @@ export interface ShortUrlsTableProps { renderOrderIcon?: (column: OrderableFields) => ReactNode; shortUrlsList: ShortUrlsListState; selectedServer: SelectedServer; - refreshList?: Function; + refreshList?: (params: ShortUrlsListParams) => void; shortUrlsListParams?: ShortUrlsListParams; className?: string; } diff --git a/src/short-urls/helpers/ShortUrlsRow.tsx b/src/short-urls/helpers/ShortUrlsRow.tsx index 7d7c6154..dde58c1e 100644 --- a/src/short-urls/helpers/ShortUrlsRow.tsx +++ b/src/short-urls/helpers/ShortUrlsRow.tsx @@ -16,7 +16,7 @@ import { ShortUrlsRowMenuProps } from './ShortUrlsRowMenu'; import './ShortUrlsRow.scss'; export interface ShortUrlsRowProps { - refreshList?: Function; + refreshList?: (params: ShortUrlsListParams) => void; shortUrlsListParams?: ShortUrlsListParams; selectedServer: SelectedServer; shortUrl: ShortUrl;