Skip to content

Commit

Permalink
Fixed server errors with nuxt
Browse files Browse the repository at this point in the history
  • Loading branch information
Explicit12 committed May 20, 2024
1 parent 24c2712 commit 358e4e3
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/service.ui/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,16 @@ export default class UIServiceDefault {
HYPHEN_SYMBOL = "-";

constructor() {
this.isMac = this.checkIsMac();
// Needed to avoid error in server context for ssr
// TODO: Find way call it in browser
// Possible solution: https://github.com/nuxt/nuxt/discussions/7878
const isBrowser = typeof window !== "undefined";

this.isPWA = this.checkIsPWA();
this.isIOS = this.checkIsIOS();
this.isAndroid = this.checkIsAndroid();
this.isMac = isBrowser && this.checkIsMac();

this.isPWA = isBrowser && this.checkIsPWA();
this.isIOS = isBrowser && this.checkIsIOS();
this.isAndroid = isBrowser && this.checkIsAndroid();

this.isMobileApp = this.isPWA || this.isIOS || this.isAndroid;
}
Expand Down

0 comments on commit 358e4e3

Please sign in to comment.