Skip to content

Commit

Permalink
feat: added persistent state
Browse files Browse the repository at this point in the history
  • Loading branch information
risv1 committed May 1, 2024
1 parent 02072e2 commit b08b7c3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
devtools: { enabled: true },
modules: ['@nuxtjs/tailwindcss', 'shadcn-nuxt', '@pinia/nuxt'],
modules: ['@nuxtjs/tailwindcss', 'shadcn-nuxt', '@pinia/nuxt', '@pinia-plugin-persistedstate/nuxt'],
shadcn: {
prefix: '',
componentDir: './components/ui'
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"db:push": "drizzle-kit push:pg"
},
"dependencies": {
"@pinia-plugin-persistedstate/nuxt": "^1.2.0",
"@pinia/nuxt": "^0.5.1",
"@types/bcrypt": "^5.0.2",
"@types/jsonwebtoken": "^9.0.6",
Expand Down
3 changes: 3 additions & 0 deletions store/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ export const useAuthStore = defineStore({
state: () => ({
user: null as User | null,
}),
persist: {
storage: persistedState.localStorage,
},
actions: {
async setUser(user: User | null) {
this.user = user;
Expand Down

0 comments on commit b08b7c3

Please sign in to comment.