From 52bce0b9f12bc571402355ac7d751b2050477adb Mon Sep 17 00:00:00 2001 From: kolaente Date: Mon, 22 Jul 2019 13:27:20 +0200 Subject: [PATCH] Use the new listuser endpoint to search for users --- src/components/tasks/edit-task.vue | 10 +++++----- src/services/listUsers.js | 14 ++++++++++++++ 2 files changed, 19 insertions(+), 5 deletions(-) create mode 100644 src/services/listUsers.js diff --git a/src/components/tasks/edit-task.vue b/src/components/tasks/edit-task.vue index df66929a..e8fdb783 100644 --- a/src/components/tasks/edit-task.vue +++ b/src/components/tasks/edit-task.vue @@ -138,7 +138,7 @@ :options="foundUsers" :multiple="false" :searchable="true" - :loading="userService.loading" + :loading="listUserService.loading" :internal-search="true" @search-change="findUser" placeholder="Type to search" @@ -245,7 +245,7 @@ import TaskService from '../../services/task' import TaskModel from '../../models/task' import UserModel from '../../models/user' - import UserService from '../../services/user' + import ListUserService from '../../services/listUsers' import priorities from '../../models/priorities' import LabelTaskService from '../../services/labelTask' import LabelService from '../../services/label' @@ -277,7 +277,7 @@ }, newAssignee: UserModel, - userService: UserService, + listUserService: ListUserService, foundUsers: [], labelService: LabelService, @@ -306,7 +306,7 @@ this.listService = new ListService() this.taskService = new TaskService() this.newTask = new TaskModel() - this.userService = new UserService() + this.listUserService = new ListUserService() this.newAssignee = new UserModel() this.labelService = new LabelService() this.labelTaskService = new LabelTaskService() @@ -374,7 +374,7 @@ return } - this.userService.getAll({}, {s: query}) + this.listUserService.getAll({listID: this.$route.params.id}, {s: query}) .then(response => { // Filter the results to not include users who are already assigned this.$set(this, 'foundUsers', differenceWith(response, this.taskEditTask.assignees, (first, second) => { diff --git a/src/services/listUsers.js b/src/services/listUsers.js new file mode 100644 index 00000000..f8f6ed93 --- /dev/null +++ b/src/services/listUsers.js @@ -0,0 +1,14 @@ +import AbstractService from './abstractService' +import UserModel from '../models/user' + +export default class ListUserService extends AbstractService { + constructor() { + super({ + getAll: '/lists/{listID}/listusers' + }) + } + + modelFactory(data) { + return new UserModel(data) + } +} \ No newline at end of file