+
+ );
+}
+
export function Header({pathname, searchPlatforms, noSearch}: Props) {
+ // this should work on production (given the request is not blocked by ad blockers),
+ // but it doesn't on dev or previews because of CORS
+ // I implemeted a workaround in the form of an api route while building this
+ const [user, setUser] = useState(null);
+ useEffect(() => {
+ fetch('https://sentry.io/api/0/users/me/', {credentials: 'include'})
+ .then(r => r.json())
+ .then(setUser)
+ // eslint-disable-next-line no-console
+ .catch(console.error);
+ }, []);
return (
{/* define a header-height variable for consumption by other components */}
@@ -64,13 +109,19 @@ export function Header({pathname, searchPlatforms, noSearch}: Props) {
ChangelogSandbox
- Sign In
-
- Get Started
-
+ {user ? (
+
+ ) : (
+
+ Sign In
+
+ Get Started
+
+
+ )}