diff --git a/website/src/theme/DocPage/index.js b/website/src/theme/DocPage/index.js
index 447b81cf..ce73867b 100644
--- a/website/src/theme/DocPage/index.js
+++ b/website/src/theme/DocPage/index.js
@@ -139,46 +139,46 @@ function DocPage(props) {
);
// CUSTOM DOCPAGE
- const [isUserAuthorized, setIsUserAuthorized] = useState()
- const [isLoading, setIsLoading] = useState(true)
- const [redirectState, setRedirectState] = useState()
- const authQuery = qs.parse(location.search);
- const [userAccessToken, setUserAccessToken] = useState((() => {
- if (typeof window !== "undefined") return window.localStorage.getItem('user-github-key')
- })())
+ if (typeof window !== "undefined" && window?.location?.hostname !== "localhost") {
+ const [isUserAuthorized, setIsUserAuthorized] = useState()
+ const [isLoading, setIsLoading] = useState(true)
+ const [redirectState, setRedirectState] = useState()
+ const authQuery = qs.parse(location.search);
+ const [userAccessToken, setUserAccessToken] = useState((() => {
+ if (typeof window !== "undefined") return window.localStorage.getItem('user-github-key')
+ })())
- useEffect(async () => {
- if (userAccessToken) {
- const user = await getUser(userAccessToken)
- setIsUserAuthorized(user)
- } else {
- if (!isEmpty(authQuery)) { //callback after successful auth with github)
- const isUserCollaborator = await checkUserCollaboratorStatus(authQuery.code);
- if (isUserCollaborator?.status === 200) {
- setUserAccessToken(isUserCollaborator.access_token)
- if (typeof window !== "undefined") window.localStorage.setItem('user-github-key', isUserCollaborator.access_token);
- } else {
- setIsUserAuthorized({ status: 401 })
+ useEffect(async () => {
+ if (userAccessToken) {
+ const user = await getUser(userAccessToken)
+ setIsUserAuthorized(user)
+ } else {
+ if (!isEmpty(authQuery)) { //callback after successful auth with github)
+ const isUserCollaborator = await checkUserCollaboratorStatus(authQuery.code);
+ if (isUserCollaborator?.status === 200) {
+ setUserAccessToken(isUserCollaborator.access_token)
+ if (typeof window !== "undefined") window.localStorage.setItem('user-github-key', isUserCollaborator.access_token);
+ } else {
+ setIsUserAuthorized({ status: 401 })
+ }
}
}
+ setIsLoading(false)
+ }, [userAccessToken])
+
+
+ if (isLoading) return
+
+ if ((isUserAuthorized?.status && isUserAuthorized?.status === 401)) {
+ return
}
- setIsLoading(false)
- }, [userAccessToken])
-
- if (isLoading) return
-
- if ((isUserAuthorized?.status && isUserAuthorized?.status === 401)) {
- return
+ if (!isUserAuthorized) {
+ return (
+
+ )
+ }
}
-
- if (!isUserAuthorized) {
- return (
-
- )
- }
-
-
// END CUSTOM DOCPAGE
if (!currentDocRoute) {