34 lines
932 B
JavaScript
34 lines
932 B
JavaScript
/*
|
|
작성자 : 공현지
|
|
작성일 : 2025-01-24
|
|
수정자 :
|
|
수정일 :
|
|
설명 : 사용자 전체 목록
|
|
*/
|
|
import { defineStore } from "pinia";
|
|
import axios from "@api";
|
|
|
|
export const useUserStore = defineStore("userStore", {
|
|
state: () => ({
|
|
userList: [],
|
|
userInfo: {}
|
|
}),
|
|
actions: {
|
|
async fetchUserList() {
|
|
const response = await axios.get('user/allUserList');
|
|
console.log('response',response)
|
|
this.userList = response.data.data.allUserList;
|
|
this.userInfo = response.data.data.user;
|
|
|
|
if (this.userInfo) {
|
|
const index = this.userList.findIndex(user => user.MEMBERSEQ === this.userInfo.id);
|
|
if (index !== -1) {
|
|
const [user] = this.userList.splice(index, 1);
|
|
this.userList.unshift(user);
|
|
}
|
|
}
|
|
|
|
},
|
|
},
|
|
});
|