Fix web project build errors

This commit is contained in:
Gabe Kangas
2022-05-11 23:31:31 -07:00
parent b66617961d
commit 72c01e1b9a
86 changed files with 863 additions and 813 deletions

View File

@@ -17,15 +17,15 @@ export default function useWindowSize() {
height: window.innerHeight,
});
}
// Add event listener
window.addEventListener("resize", handleResize);
window.addEventListener('resize', handleResize);
// Call handler right away so state gets updated with initial window size
handleResize();
// Remove event listener on cleanup
return () => window.removeEventListener("resize", handleResize);
return () => window.removeEventListener('resize', handleResize);
}, []); // Empty array ensures that effect is only run on mount
return windowSize;

View File

@@ -5,11 +5,15 @@ export default function isValidUrl(url: string): boolean {
const validProtocols = ['http:', 'https:'];
try {
const validationObject = new URL(url);
if (validationObject.protocol === '' || validationObject.hostname === '' || !validProtocols.includes(validationObject.protocol)) {
return false;
}
} catch(e) {
const validationObject = new URL(url);
if (
validationObject.protocol === '' ||
validationObject.hostname === '' ||
!validProtocols.includes(validationObject.protocol)
) {
return false;
}
} catch (e) {
return false;
}