mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Fix error 'window is undefined' that appears sometimes
- Avoid possible errors, because of 'window' is only defined on browser side but not in NodeJS on client side. Check for 'typeof window' is neccessary, because if it's not defined at all you can't check for 'window !== undefined' without the same error 'window is undefined'.
This commit is contained in:
parent
4fccb6e788
commit
e3ea3e1733
@ -11,7 +11,10 @@ export function internalPageMixins(pageParams) {
|
||||
},
|
||||
created() {
|
||||
if (!this.pageParams.isInternalPage) {
|
||||
window.location.href = this.pageParams.externalLink
|
||||
// to avoid possible errors, because 'window' is only defined on browser side but not in NodeJS on client side. check for 'typeof window' is neccessary, because if it's not defined at all you can't check for 'window !== undefined' without the same error 'window is undefined'
|
||||
if (typeof window !== 'undefined') {
|
||||
window.location.href = this.pageParams.externalLink
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user