Browse Source

fix: update user local state issue

pull/7342/head
Ramesh Mane 10 months ago
parent
commit
e81cb2faea
  1. 6
      packages/nc-gui/components/account/UserList.vue

6
packages/nc-gui/components/account/UserList.vue

@ -1,7 +1,6 @@
<script lang="ts" setup> <script lang="ts" setup>
import { OrgUserRoles } from 'nocodb-sdk' import { OrgUserRoles } from 'nocodb-sdk'
import type { OrgUserReqType, RequestParams, UserType } from 'nocodb-sdk' import type { OrgUserReqType, RequestParams, UserType } from 'nocodb-sdk'
import rfdc from 'rfdc'
import type { User } from '#imports' import type { User } from '#imports'
import { import {
extractSdkResponseErrorMsg, extractSdkResponseErrorMsg,
@ -34,7 +33,6 @@ const { sorts, sortDirection, loadSorts, saveOrUpdate, handleGetSortsData } = us
const users = ref<UserType[]>([]) const users = ref<UserType[]>([])
const sortedUsers = computed(() => { const sortedUsers = computed(() => {
console.log('users', users.value)
return handleGetSortsData(users.value, sorts.value) as UserType[] return handleGetSortsData(users.value, sorts.value) as UserType[]
}) })
@ -56,8 +54,6 @@ const pagination = reactive({
position: ['bottomCenter'], position: ['bottomCenter'],
}) })
const clone = rfdc()
const loadUsers = useDebounceFn(async (page = currentPage.value, limit = currentLimit.value) => { const loadUsers = useDebounceFn(async (page = currentPage.value, limit = currentLimit.value) => {
currentPage.value = page currentPage.value = page
try { try {
@ -93,7 +89,7 @@ const updateRole = async (userId: string, roles: string) => {
} as OrgUserReqType) } as OrgUserReqType)
message.success(t('msg.success.roleUpdated')) message.success(t('msg.success.roleUpdated'))
users.value = clone(users.value).map((user) => { users.value.forEach((user) => {
if (user.id === userId) { if (user.id === userId) {
user.roles = roles user.roles = roles
} }

Loading…
Cancel
Save