mirror of
https://github.com/continew-org/continew-admin-ui.git
synced 2025-09-10 20:57:10 +08:00
38 lines
835 B
TypeScript
38 lines
835 B
TypeScript
// src/stores/modules/auth.ts
|
|
import { defineStore } from 'pinia'
|
|
|
|
export const useAuthStore = defineStore('auth', {
|
|
state: () => ({
|
|
isRegister: false,
|
|
isEmailLogin: false,
|
|
isForgotPassword: false,
|
|
activeKey: '1',
|
|
}),
|
|
actions: {
|
|
toggleMode() {
|
|
if (this.isEmailLogin) {
|
|
this.isEmailLogin = !this.isEmailLogin
|
|
} else {
|
|
this.isForgotPassword = !this.isForgotPassword
|
|
}
|
|
},
|
|
toggleEmailLoginMode() {
|
|
this.isEmailLogin = !this.isEmailLogin
|
|
},
|
|
toggleRegisterMode() {
|
|
const keyMap = {
|
|
1: '3',
|
|
2: '4',
|
|
3: '1',
|
|
4: '2',
|
|
}
|
|
this.isRegister = !this.isRegister
|
|
this.isEmailLogin = false
|
|
this.activeKey = keyMap[this.activeKey]
|
|
},
|
|
onTabChange(key: string) {
|
|
this.activeKey = key
|
|
},
|
|
},
|
|
})
|