Fix web project build errors
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user