There are cases where you will need to handle auth errors pertaining to the request rather than the auth module itself. For instance, when utilizing the local scheme and you have a non-expiring token, and you revoke the token (in your server) (for whatever reason), the token will still be there in the store manager.
With that said a new option resetOnResponseError has been introduced. This can be a Boolean or a Function. Similar to resetOnError, but this one is for the request handler. As a function it uses 3 arguments: error, auth, and scheme
it would look something like this in your Nuxt config:
Functions within the module options were getting removed due to Nuxt turning them into strings thereby remove functions in the process. This will fix that issue.
Module Options: Redirects
The redirect options can now be defined as functions that returns strings, the function has access to the auth instance and the localePath instance (but this one isnt typed properly so you can use the auth instance to get to Nuxt's context for typing):
By default all redirect options goes through localePath if it's available, if you would like to prevent this, turn the property into a function and just return the string.
Changes & Additions
Request Handler
There are cases where you will need to handle auth errors pertaining to the request rather than the auth module itself. For instance, when utilizing the local scheme and you have a non-expiring token, and you revoke the token (in your server) (for whatever reason), the token will still be there in the store manager.
With that said a new option
resetOnResponseError
has been introduced. This can be a Boolean or a Function. Similar toresetOnError
, but this one is for the request handler. As a function it uses 3 arguments:error
,auth
, andscheme
it would look something like this in your Nuxt config:The option is disabled by default.
Module Options
Functions within the module options were getting removed due to Nuxt turning them into strings thereby remove functions in the process. This will fix that issue.
Module Options: Redirects
The redirect options can now be defined as functions that returns strings, the function has access to the auth instance and the localePath instance (but this one isnt typed properly so you can use the auth instance to get to Nuxt's context for typing):
By default all redirect options goes through localePath if it's available, if you would like to prevent this, turn the property into a function and just return the string.