From 854c0c91e92ffea8df631be3e944fea72c7d5ae9 Mon Sep 17 00:00:00 2001 From: khj0414 Date: Fri, 7 Feb 2025 10:30:18 +0900 Subject: [PATCH] =?UTF-8?q?userList=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/user/UserList.vue | 75 +++++++++++++++++++------------- src/stores/userList.js | 14 +++++- 2 files changed, 57 insertions(+), 32 deletions(-) diff --git a/src/components/user/UserList.vue b/src/components/user/UserList.vue index aaf9f7a..2e51510 100644 --- a/src/components/user/UserList.vue +++ b/src/components/user/UserList.vue @@ -1,33 +1,29 @@ + diff --git a/src/stores/userList.js b/src/stores/userList.js index 25fbb9a..767e711 100644 --- a/src/stores/userList.js +++ b/src/stores/userList.js @@ -11,11 +11,23 @@ import axios from "@api"; export const useUserStore = defineStore("userStore", { state: () => ({ userList: [], + userInfo: {} }), actions: { async fetchUserList() { const response = await axios.get('user/allUserList'); - this.userList = response.data.data; + 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); + } + } + }, }, });