Skip to content

v3.0.0#79

Merged
Denoder merged 4 commits intomainfrom
v3.0.0
Nov 23, 2023
Merged

v3.0.0#79
Denoder merged 4 commits intomainfrom
v3.0.0

Conversation

@Denoder
Copy link
Copy Markdown
Member

@Denoder Denoder commented Nov 23, 2023

Changes & Additions

Pinia

Pinia is no longer required to use the auth module but can still be used. By default, it is disabled and instead nuxt's useState will be used instead.

Storage

  • Moved login watch to a plugin.
  • Consolidated store/storage options: localStorage, sessionStorage, cookie, and pinia have all been moved under on property called stores. The storage names also been shortened so localStorage is local, cookie is cookie, and sessionStorage is session.
  • The strategy cookie, will no longer be present if you're not logged in.
  • The syncUniversal/setUniversal now accept a third object parameter that dictates whether or not you want to exclude a store (the store won't be added in any case if it's disabled in your options). In the case for cookies, you can either use a boolean or an object which contains the cookie's options.

Cookie Scheme

  • The Cookie scheme has been added back under the local scheme. It still retains the same functionality if you're not using the token property.
  • The Laravel Sanctum provider will use the token method by default, if you would like to use the SPA method set token.type to false.

Typescript

  • When configuring the auth module options for the strategies would have no type hinting. This version should help fix that.

Nuxt i18n

The module now has basic support for nuxt/i18n. Since this is new, if you encounter any issues please don't hesitate to ask. The i18n will change the locale of the redirects.


Documentation

I don't have the resources to set up a documentation page for all of these, but I still do have the Stackblitz setup so you may use that as I will update it when needed.

- Changed storage reliance on pinia:

Pinia is no longer required to use the auth module, but can still be used. By default it is disabled and instead nuxt's useState will be used instead.

- Moved login watch to plugin:

This is still in testing however I found that watching loggedIn works better when it's in a plugin.

- Consolidated store/storage options:

localStorage, sessionStorage, cookie, and pinia have all been moved under on property called 'stores'. Theves also been shortened in name so localStorage is 'local', cookie is 'cookie', and sessionStorage is 'session'.

The strategy cookie, will no longer be present if you're not logged in.

The syncUniversal/setUniversal now accept a third object parameter that dictates whether or not you want to exclude a store (the store wont be added in any case if its disabled in your options). In the case for cookies you can either use a boolean or an object which contains the cookie's options.
 - The Cookie scheme has been added back under the local scheme. It still retains the same functionality if you're not using the token property.

-  The Laravel Sanctum provider will use the token method, if you'd like to use the  SPA method set token.type to false.

 - Documentation stackblitz has been update to reflect changes: https://stackblitz.com/edit/github-nufjhw?file=README.md
- When configuring the auth options the strategies would have no type hinting. This update aims to fix this.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant