Skip to content

Commit

Permalink
fix host filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
franciscao633 committed Jun 19, 2024
1 parent cda3ba3 commit 3f477c5
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 7 deletions.
3 changes: 2 additions & 1 deletion src/components/hooks/useFilterParams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export function useFilterParams(websiteId: string) {
const { startDate, endDate, unit } = dateRange;
const { timezone } = useTimezone();
const {
query: { url, referrer, title, query, os, browser, device, country, region, city, event },
query: { url, referrer, title, query, host, os, browser, device, country, region, city, event },
} = useNavigation();

return {
Expand All @@ -20,6 +20,7 @@ export function useFilterParams(websiteId: string) {
referrer,
title,
query,
host,
os,
browser,
device,
Expand Down
2 changes: 1 addition & 1 deletion src/lib/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const FILTER_REFERRERS = 'filter-referrers';
export const FILTER_PAGES = 'filter-pages';

export const UNIT_TYPES = ['year', 'month', 'hour', 'day', 'minute'];
export const EVENT_COLUMNS = ['url', 'entry', 'exit', 'referrer', 'title', 'query', 'event', 'host'];
export const EVENT_COLUMNS = ['url', 'entry', 'exit', 'referrer', 'title', 'query', 'event'];

export const SESSION_COLUMNS = [
'browser',
Expand Down
1 change: 1 addition & 0 deletions src/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ export interface QueryFilters {
referrer?: string;
title?: string;
query?: string;
host?: string;
os?: string;
browser?: string;
device?: string;
Expand Down
4 changes: 3 additions & 1 deletion src/pages/api/websites/[websiteId]/events.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { canViewWebsite } from 'lib/auth';
import { useAuth, useCors, useValidate } from 'lib/middleware';
import { getRequestFilters, getRequestDateRange } from 'lib/request';
import { getRequestDateRange, getRequestFilters } from 'lib/request';
import { NextApiRequestQueryBody, WebsiteMetric } from 'lib/types';
import { TimezoneTest, UnitTypeTest } from 'lib/yup';
import { NextApiResponse } from 'next';
Expand All @@ -17,6 +17,7 @@ export interface WebsiteEventsRequestQuery {
url: string;
referrer?: string;
title?: string;
host?: string;
os?: string;
browser?: string;
device?: string;
Expand All @@ -35,6 +36,7 @@ const schema = {
url: yup.string(),
referrer: yup.string(),
title: yup.string(),
host: yup.string(),
os: yup.string(),
browser: yup.string(),
device: yup.string(),
Expand Down
2 changes: 2 additions & 0 deletions src/pages/api/websites/[websiteId]/metrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export interface WebsiteMetricsRequestQuery {
referrer?: string;
title?: string;
query?: string;
host?: string;
os?: string;
browser?: string;
device?: string;
Expand All @@ -40,6 +41,7 @@ const schema = {
referrer: yup.string(),
title: yup.string(),
query: yup.string(),
host: yup.string(),
os: yup.string(),
browser: yup.string(),
device: yup.string(),
Expand Down
4 changes: 2 additions & 2 deletions src/pages/api/websites/[websiteId]/pageviews.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ export interface WebsitePageviewRequestQuery {
timezone?: string;
url?: string;
referrer?: string;
host?: string;
title?: string;
host?: string;
os?: string;
browser?: string;
device?: string;
Expand All @@ -37,8 +37,8 @@ const schema = {
timezone: TimezoneTest,
url: yup.string(),
referrer: yup.string(),
host: yup.string(),
title: yup.string(),
host: yup.string(),
os: yup.string(),
browser: yup.string(),
device: yup.string(),
Expand Down
4 changes: 2 additions & 2 deletions src/pages/api/websites/[websiteId]/stats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ export interface WebsiteStatsRequestQuery {
endAt: number;
url?: string;
referrer?: string;
host?: string;
title?: string;
query?: string;
event?: string;
host?: string;
os?: string;
browser?: string;
device?: string;
Expand All @@ -34,10 +34,10 @@ const schema = {
endAt: yup.number().required(),
url: yup.string(),
referrer: yup.string(),
host: yup.string(),
title: yup.string(),
query: yup.string(),
event: yup.string(),
host: yup.string(),
os: yup.string(),
browser: yup.string(),
device: yup.string(),
Expand Down

0 comments on commit 3f477c5

Please sign in to comment.