Skip to content

Commit

Permalink
fix: fix ssr
Browse files Browse the repository at this point in the history
  • Loading branch information
aelf-lxy committed Aug 7, 2024
1 parent 0c101a5 commit aed24c5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/login/src/context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ export default function Provider({ children, ...props }: WebLoginProviderProps)
};
}
}, []);
if (!scriptLoaded) {
if (typeof window !== 'undefined' && !scriptLoaded) {
return null;
}

Expand Down
3 changes: 3 additions & 0 deletions packages/login/src/utils/isMobile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ const notMobileRE = /CrOS/;
const tabletRE = /android|ipad|playbook|silk/i;

export default function isMobile() {
if (typeof navigator === 'undefined') {
return false;
}
const ua = navigator.userAgent;
if (typeof ua !== 'string') return false;

Expand Down

0 comments on commit aed24c5

Please sign in to comment.