Domain validation. Filter domain from referrers.

This commit is contained in:
Mike Cao 2020-08-28 21:34:20 -07:00
parent a9765c7ea7
commit 5a4cde854a
13 changed files with 51 additions and 23 deletions

View file

@ -65,9 +65,9 @@ export default function WebsiteDetails({ websiteId, defaultDateRange = '7day' })
const tableProps = {
...dataProps,
websiteDomain: data?.domain,
limit: 10,
onExpand: handleExpand,
websiteDomain: data?.domain,
};
const DetailsComponent = expand?.component;

View file

@ -8,7 +8,8 @@ import FormLayout, {
FormMessage,
FormRow,
} from 'components/layout/FormLayout';
import Checkbox from '../common/Checkbox';
import Checkbox from 'components/common/Checkbox';
import { DOMAIN_REGEX } from 'lib/constants';
const initialValues = {
name: '',
@ -24,6 +25,8 @@ const validate = ({ name, domain }) => {
}
if (!domain) {
errors.domain = 'Required';
} else if (!DOMAIN_REGEX.test(domain)) {
errors.domain = 'Invalid domain';
}
return errors;

View file

@ -14,6 +14,7 @@ export default function MetricsTable({
title,
metric,
websiteId,
websiteDomain,
startDate,
endDate,
type,
@ -47,6 +48,7 @@ export default function MetricsTable({
type,
start_at: +startDate,
end_at: +endDate,
domain: websiteDomain,
});
setData(data);

View file

@ -30,6 +30,7 @@ export default function Referrers({
metric="Views"
headerComponent={limit ? null : <FilterButtons selected={filter} onClick={setFilter} />}
websiteId={websiteId}
websiteDomain={websiteDomain}
startDate={startDate}
endDate={endDate}
limit={limit}