1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-06-30 22:46:39 -04:00

extract sentry config/init

This commit is contained in:
2022-02-12 11:24:31 -05:00
parent e4cd233530
commit cb28562869
7 changed files with 89 additions and 68 deletions

View File

@ -14,22 +14,26 @@ const HitCounter = ({ slug, className }: HitCounterProps) => {
revalidateOnFocus: false,
});
// show spinning loading indicator if data isn't fetched yet
if (!data) {
return <Loading boxes={3} width={20} />;
}
try {
// show spinning loading indicator if data isn't fetched yet
if (!data) {
return <Loading boxes={3} width={20} />;
}
// fail secretly
if (error) {
return;
}
// fail secretly
if (error) {
return null;
}
// we have data!
return (
<span title={`${data.hits.toLocaleString("en-US")} ${data.hits === 1 ? "view" : "views"}`} className={className}>
{data.hits.toLocaleString("en-US")}
</span>
);
// we have data!
return (
<span title={`${data.hits.toLocaleString("en-US")} ${data.hits === 1 ? "view" : "views"}`} className={className}>
{data.hits.toLocaleString("en-US")}
</span>
);
} catch (error) {
return null;
}
};
export default HitCounter;

View File

@ -31,7 +31,7 @@ const VNC = ({ server }: VNCProps) => {
terminalRef.current.textContent = `${message}${
anyKey ? "\n\nPress the Any key or refresh the page to continue." : ""
}`;
} catch (e) {} // eslint-disable-line no-empty
} catch (error) {} // eslint-disable-line no-empty
};
// hides the console and show the screen when VM connects
@ -44,7 +44,7 @@ const VNC = ({ server }: VNCProps) => {
const disconnectVM = () => {
try {
rfbRef.current.disconnect();
} catch (e) {} // eslint-disable-line no-empty
} catch (error) {} // eslint-disable-line no-empty
};
// prepare for possible navigation away from this page, and disconnect if/when it happens