Skip to content

Commit

Permalink
Persist Auth store
Browse files Browse the repository at this point in the history
  • Loading branch information
lcharette committed Sep 17, 2023
1 parent 1aea12f commit 57458db
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/assets/main.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import { createApp } from 'vue'
import { createPinia } from 'pinia'
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
import App from '@/App.vue'
import router from '@/router'

const pinia = createPinia()
const app = createApp(App)

// Pinia plugin to persist state in localStorage
pinia.use(piniaPluginPersistedstate)

app.use(router)
app.use(pinia)
app.mount('#app')
1 change: 1 addition & 0 deletions app/assets/stores/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { defineStore } from "pinia";
import axios from "axios";

export const useAuthStore = defineStore("auth", {
persist: true,
state: () => {
return {
loading: false,
Expand Down
9 changes: 9 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"@fontsource/montserrat": "^5.0.8",
"axios": "^1.5.0",
"pinia": "^2.1.6",
"pinia-plugin-persistedstate": "^3.2.0",
"uikit": "^3.16.26",
"vue": "^3.3.4",
"vue-router": "^4.2.4"
Expand Down

0 comments on commit 57458db

Please sign in to comment.