Implemented domain visits section

This commit is contained in:
Alejandro Celaya
2022-04-24 18:36:25 +02:00
parent 932dec3bde
commit 05254326cb
8 changed files with 176 additions and 7 deletions

View File

@@ -1,6 +1,7 @@
import { isNil } from 'ramda';
import { ShortUrl } from '../data';
import { OptionalString } from '../../utils/utils';
import { DEFAULT_DOMAIN } from '../../visits/reducers/domainVisits';
export const shortUrlMatches = (shortUrl: ShortUrl, shortCode: string, domain: OptionalString): boolean => {
if (isNil(domain)) {
@@ -9,3 +10,11 @@ export const shortUrlMatches = (shortUrl: ShortUrl, shortCode: string, domain: O
return shortUrl.shortCode === shortCode && shortUrl.domain === domain;
};
export const domainMatches = (shortUrl: ShortUrl, domain: string): boolean => {
if (!shortUrl.domain && domain === DEFAULT_DOMAIN) {
return true;
}
return shortUrl.domain === domain;
};