on master help sign in
bridge: only use window.ethereum if it exists
af3a63afang
src/Bridge.js+5−3
@@ -70,9 +70,11 @@ function Bridge() {
70 // full reload if the user changes their selected network in Metamask
70 // full reload if the user changes their selected network in Metamask
71 //
71 //
72 useEffect(() => {
72 useEffect(() => {
73+ if (window.ethereum) {
73− window.ethereum.on('chainChanged', () => {
74+ window.ethereum.on('chainChanged', () => {
74− document.location.reload();
75+ document.location.reload();
75− });
76+ });
77+ }
76 }, []);
78 }, []);
77
79
78 return (
80 return (