You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 21, 2022. It is now read-only.
Hi, thanks for making this module!
I was wondering if it is possible for us to have a global error handler for Userbase in this?
Or is this something that Userbase has to implement in the SDK?
The text was updated successfully, but these errors were encountered:
this.$userbase.updateUser({
...someData}).then(()=>{// do something}).catch((e)=>{this.$eventBus.$emit('userbase-error',e);})
If one has many such calls spread throughout the application, dealing with the error at each call is quite cumbersome. Instead, if we could intercept the error in a plugin (like we can with Axios), it can be dealt with in a generic manner.
My solution for now is to emit an event inside the catch and deal with the error event inside a plugin.
// The userbase function callthis.$userbase.updateUser({
...someData}).then(()=>{// do something}).catch((e)=>{this.$eventBus.$emit('userbase-error',e);})
// userbase-error.js pluginimportVuefrom'vue'exportdefaultasyncfunction({ app },inject){inject('eventBus',newVue());// inject eventBus to emit the event laterapp.$eventBus.$on('userbase-error',(err)=>{// Deal with the error in a generic fashion - maybe show a snackbar or a toast}}
This can also be done using mixins (and using this.$nuxt.$emit) instead of injecting the event bus.
If Userbase had such a mechanism or if this module can implement it, that'd be awesome.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hi, thanks for making this module!
I was wondering if it is possible for us to have a global error handler for Userbase in this?
Or is this something that Userbase has to implement in the SDK?
The text was updated successfully, but these errors were encountered: