From bc81cbb6e2e96b24a0cb2549a7ed15eaa87bcc91 Mon Sep 17 00:00:00 2001 From: Phoenix Date: Mon, 16 Sep 2019 13:59:00 +0100 Subject: [PATCH] List now working properly for user, user search with substring and without, one caveat is that if you type something into the search bar but don't search it'll act as if you're trying to do a substring search.. Might be an annoying bug or might not matter --- src/api/user.js | 3 ++- src/views/users/list.vue | 15 ++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/api/user.js b/src/api/user.js index 2dd33a75..e656ec10 100644 --- a/src/api/user.js +++ b/src/api/user.js @@ -42,9 +42,10 @@ export function logout() { }) } -export function fetchSubstringList(substring, query) { +export function fetchSubstringList(substring, query) { // This query expects that you have setthe platform in the calling class return axios.get(`${apiUrl}/user/search/${substring}/`, { params: query }) } + export function fetchList(query) { query.platform = store.state.platform return axios.get(`${apiUrl}/user/search`, { params: query }) diff --git a/src/views/users/list.vue b/src/views/users/list.vue index 6e4ecb91..8629c14f 100644 --- a/src/views/users/list.vue +++ b/src/views/users/list.vue @@ -109,12 +109,13 @@ export default { // this.listQuery.type = this.$route.meta.type this.listQuery.platform = this.$store.state.settings.platform - this.getList() + this.getFullList() }, methods: { - getList() { + getFullList() { this.listLoading = true fetchList(this.listQuery).then(response => { + console.log(response.data.docs) this.list = response.data.docs this.total = response.data.total this.listLoading = false @@ -127,14 +128,18 @@ export default { this.total = response.data.total }) }, - handleFilter() { - this.listQuery.page = 1 + getList() { + console.log(this.listQuery) if (this.substring === '') { - this.getList + this.getFullList() } else { this.getSubstring() } }, + handleFilter() { + this.listQuery.page = 1 + this.getList() + }, sendPasswordResetConfirm(email) { this.$confirm(`This will send an email to ${email}, prompting them to reset their password with the provided link. Are you sure you want to do this?`, 'Warning', { confirmButtonText: 'Proceed',