Standardize store exports to named useXxxStore convention
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { defineStore } from 'pinia';
|
||||
import apiClient from '@/api/client.js';
|
||||
import apiError from '@/module/apiError';
|
||||
import piniaLoginStore from '@/stores/login';
|
||||
import { useLoginStore } from '@/stores/login';
|
||||
import { JUST_CREATE_ACCOUNT_HOT_DURATION_MINS } from '@/constants/constants';
|
||||
|
||||
interface User {
|
||||
@@ -25,7 +25,7 @@ interface EditDetail {
|
||||
is_active: boolean;
|
||||
}
|
||||
|
||||
export default defineStore('acctMgmtStore', {
|
||||
export const useAcctMgmtStore = defineStore('acctMgmtStore', {
|
||||
persist: true,
|
||||
state: () => ({
|
||||
allUserAccoutList: [] as User[],
|
||||
@@ -99,7 +99,7 @@ export default defineStore('acctMgmtStore', {
|
||||
* Add some customization. For example, add isHovered field
|
||||
*/
|
||||
async customizeAllUserList(rawResponseData: User[]): Promise<User[]> {
|
||||
const loginStore = piniaLoginStore();
|
||||
const loginStore = useLoginStore();
|
||||
await loginStore.getUserData();
|
||||
const loginUserData:User = loginStore.userData;
|
||||
return rawResponseData.map(user => ({
|
||||
@@ -114,7 +114,7 @@ export default defineStore('acctMgmtStore', {
|
||||
* Current logged in user should be placed at the first row on list
|
||||
*/
|
||||
async moveCurrentLoginUserToFirstRow(fetchedUserList: User[]): Promise<User[]> {
|
||||
const loginStore = piniaLoginStore();
|
||||
const loginStore = useLoginStore();
|
||||
await loginStore.getUserData();
|
||||
const loginUserData:User = loginStore.userData;
|
||||
const foundLoginUserIndex = fetchedUserList.findIndex(user => user.username === loginUserData.username);
|
||||
|
||||
Reference in New Issue
Block a user