updated Service of users
This commit is contained in:
parent
327f716fe9
commit
e2fe94c1de
@ -105,7 +105,8 @@ class UsersOfServices {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {Object} params
|
||||
* @param {String} key - field name
|
||||
* @param {Any} value - updated data for selected user, send to server
|
||||
* @returns {Promise<Object>}
|
||||
*/
|
||||
async setUserFields(key, value) {
|
||||
@ -117,23 +118,6 @@ class UsersOfServices {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {Number} selectedUserId
|
||||
* @param {Number} serviceId
|
||||
* @returns {Promise<Object>}
|
||||
*/
|
||||
async deleteUserFromService(selectedUserId, serviceId) {
|
||||
// const deletedUser = await this.adapter.addUser(selectedUserId, serviceId) // Запрос на обновление пользователя с новым service_id???
|
||||
const users = this.store.getters['users/users']
|
||||
const updatedUsers = deleteServiceIdFromUser(selectedUserId, serviceId, users)
|
||||
const usersWithService = usersWithThisService(serviceId, updatedUsers)
|
||||
const usersWithoutService = usersWithoutThisService(serviceId, updatedUsers)
|
||||
this.store.dispatch('users/updateUsers', updatedUsers)
|
||||
this.store.dispatch('users/updateUsersWithService', usersWithService)
|
||||
this.store.dispatch('users/updateUsersWithoutService', usersWithoutService)
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {Number} serviceId - updated data for selected user, send to server
|
||||
@ -172,6 +156,23 @@ class UsersOfServices {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {Number} selectedUserId
|
||||
* @param {Number} serviceId
|
||||
* @returns {Promise<Object>}
|
||||
*/
|
||||
async deleteUserFromService(selectedUserId, serviceId) {
|
||||
// const deletedUser = await this.adapter.addUser(selectedUserId, serviceId) // Запрос на обновление пользователя с новым service_id???
|
||||
const users = this.store.getters['users/users']
|
||||
const updatedUsers = deleteServiceIdFromUser(selectedUserId, serviceId, users)
|
||||
const usersWithService = usersWithThisService(serviceId, updatedUsers)
|
||||
const usersWithoutService = usersWithoutThisService(serviceId, updatedUsers)
|
||||
this.store.dispatch('users/updateUsers', updatedUsers)
|
||||
this.store.dispatch('users/updateUsersWithService', usersWithService)
|
||||
this.store.dispatch('users/updateUsersWithoutService', usersWithoutService)
|
||||
}
|
||||
|
||||
async resetStore() {
|
||||
this.store.dispatch('users/resetStore')
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user