tv-toast
tv-toast copied to clipboard
Nuxt process client
In nuxt if I call the this.$toast.show('foo')
it will throw an error: Cannot read property 'show' of undefined, this is because window is not present on ssr, specifying mode: 'client' in nuxt.config.js doesn't work, so the only thing to avoid this is to check for process.client every time I call this.$toast.show, is there a way to asbtract this? so that I don't have to create ifs everytime?
@popovicieduard are you able to share your repo/config/sample so i can duplicate this? that should help me whip up a fix
It seems that the error only throws inside asyncData, which is why the windows is not available, it works as intended in setup function, thank you anyways, I don't think this is a relevant issue, you could duplicate this by calling this.$toast.show() inside asyncData
@popovicieduard hmm yea, i'm not sure this is an issue i can address w/ in this module, i think you'd have to set something inside there that fires the toast when the code client-side gets reached.. maybe set something in data() that you can pick up and send to toasts in mounted or created? somewhere you can check that you're in the browser?