Skip to content

Commit

Permalink
bug fix (#5969)
Browse files Browse the repository at this point in the history
  • Loading branch information
montezdesousa authored Jan 18, 2024
1 parent 2f4abee commit c6c003e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions website/src/theme/Root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ export default function Root({ children }) {

useEffect(() => {
if (location.pathname.startsWith("/pro") || location.pathname.startsWith("/excel")) {
const cookie = document.cookie.split(";").find((c) => c.trim().startsWith("docs-login="));
const payload = decodeURIComponent(cookie.split('=')[1].split('.')[0]);
const cookie = document.cookie?.split(";").find((c) => c.trim().startsWith("docs-login="));
const payload = decodeURIComponent(cookie?.split('=')[1].split('.')[0]);
if (isValidBase64(payload)) {
const decodedPayload = atob(decodeURIComponent(payload));
// decide what we want to do whether the user is logged in or not
Expand All @@ -82,4 +82,4 @@ function isValidBase64(str) {
} catch (err) {
return false;
}
}
}

0 comments on commit c6c003e

Please sign in to comment.