mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-06-19 19:28:08 +02:00
Set up a basic user store
This commit is contained in:
parent
b3b948ad5e
commit
c63603ae04
4
resources/js_vue3/app.js
vendored
4
resources/js_vue3/app.js
vendored
@ -2,7 +2,7 @@ import '/resources/js_vue3/assets/app.scss';
|
||||
|
||||
import { createApp } from 'vue'
|
||||
import { i18nVue } from 'laravel-vue-i18n'
|
||||
// import { createPinia } from 'pinia'
|
||||
import { createPinia } from 'pinia'
|
||||
import App from './App.vue'
|
||||
import router from './router'
|
||||
import Notifications from '@kyvg/vue3-notification'
|
||||
@ -19,7 +19,7 @@ app.config.globalProperties.$2fauth = {
|
||||
langs: window.appLocales
|
||||
}
|
||||
|
||||
// app.use(createPinia())
|
||||
app.use(createPinia())
|
||||
app.use(router)
|
||||
app.use(i18nVue, {
|
||||
resolve: async lang => {
|
||||
|
22
resources/js_vue3/stores/user.js
vendored
Normal file
22
resources/js_vue3/stores/user.js
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
import { defineStore } from 'pinia'
|
||||
// import { useApi } from '@/api/useAPI.js'
|
||||
|
||||
// const api = useApi()
|
||||
|
||||
export const useUserStore = defineStore({
|
||||
id: 'user',
|
||||
|
||||
state: () => {
|
||||
return {
|
||||
name: 'guest',
|
||||
preferences: window.userPreferences,
|
||||
isAdmin: false,
|
||||
}
|
||||
},
|
||||
|
||||
actions: {
|
||||
updatePreference(preference) {
|
||||
this.preferences = { ...this.state.preferences, ...preference }
|
||||
},
|
||||
},
|
||||
})
|
Loading…
x
Reference in New Issue
Block a user