mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-22 06:49:35 +00:00
W / Auth
- This plugin is used for managing logged user, and will automatically inject auth store to your main store
Required third-party plugins
npm i vuex@4 && npm i axios-auth-refresh
Required internal plugins
- w/axios
Installation
- Create store.ts in
@/store.tsand initialize vuex store - Import
@/store.tsinmain.ts - Import w/auth in
main.ts
Installation example
- main.ts
import store from '@/store'
import auth from '@/plugins/w/auth'
const app = createApp(App)
.use(store)
.use(auth)
- store.ts
import { createStore } from 'vuex'
export default createStore({
modules: {}
})
Store actions
this.$store.dispatch('auth/login', credentials)
this.$store.dispatch('auth/signup', credentials)
this.$store.dispatch('auth/logout')
this.$store.dispatch('auth/forgotPassword', credentials)
this.$store.dispatch('auth/resetPassword', credentials)
this.$store.dispatch('auth/refreshToken')
this.$store.dispatch('auth/userInfo')
this.$store.dispatch('auth/updateUserInfo', user)
Store getters
this.$store.getters['auth/isLoggedIn']
this.$store.getters['auth/user']