In this lesson, we're enhancing the authentication flow by introducing a global store to manage the logged-in user's data. We'll set up a Pinia store called useAuthStore
to keep track of the user and their profile across the app.
The store will include a method setAuth
to update the user state based on the session data returned from the registration and login methods. We'll integrate this store with our existing utility functions in supaAuth.ts
, ensuring that user data is globally accessible once authenticated.
By the end of this lesson, you'll be able to log in, register users, and globally manage authentication states through the Pinia store.