fix build crash?

This commit is contained in:
Chuck Dries 2022-07-10 17:30:51 -07:00
parent c846922baf
commit f3aba3c4df
No known key found for this signature in database
GPG Key ID: A00B7AEAE1DC5BE6

View File

@ -80,11 +80,14 @@ export const getShutterFractionFromExposureTime = (exposureTime) => {
return `${numerator}/${denominator}`; return `${numerator}/${denominator}`;
}; };
export const getGalleryPageUrl = ( export const getGalleryPageUrl = ({ keyword, sortKey }, hash) => {
{ keyword, sortKey }, const url = new URL(
hash `${
) => { typeof window !== "undefined"
const url = new URL(`${window?.location.origin ?? 'https://chuckdries.com'}/photogallery/`); ? window.location.origin
: "https://chuckdries.com"
}/photogallery/`
);
if (keyword !== undefined) { if (keyword !== undefined) {
if (keyword === null) { if (keyword === null) {
url.searchParams.delete("filter"); url.searchParams.delete("filter");
@ -102,5 +105,5 @@ export const getGalleryPageUrl = (
if (hash) { if (hash) {
url.hash = hash; url.hash = hash;
} }
return url.href.toString().replace(url.origin, ''); return url.href.toString().replace(url.origin, "");
}; };