Search on frontend

This commit is contained in:
Adria Navarro 2023-05-10 15:19:45 +02:00
parent 0d5c14f22a
commit 46963bca69
3 changed files with 7 additions and 7 deletions

View File

@ -12,7 +12,7 @@
export let groupId export let groupId
let searchTerm let emailSearch
let fetchGroupUsers let fetchGroupUsers
$: fetchGroupUsers = fetchData({ $: fetchGroupUsers = fetchData({
API, API,
@ -22,7 +22,7 @@
options: { options: {
query: { query: {
groupId, groupId,
searchTerm, emailSearch,
}, },
}, },
}) })
@ -71,7 +71,7 @@
</div> </div>
<div class="controls-right"> <div class="controls-right">
<Search bind:value={searchTerm} placeholder="Search" /> <Search bind:value={emailSearch} placeholder="Search" />
</div> </div>
<Table <Table
schema={userSchema} schema={userSchema}

View File

@ -55,13 +55,13 @@ export const buildGroupsEndpoints = API => {
/** /**
* Gets a group users by the group id * Gets a group users by the group id
*/ */
getGroupUsers: async ({ id, bookmark, searchTerm }) => { getGroupUsers: async ({ id, bookmark, emailSearch }) => {
let url = `/api/global/groups/${id}/users?` let url = `/api/global/groups/${id}/users?`
if (bookmark) { if (bookmark) {
url += `bookmark=${bookmark}&` url += `bookmark=${bookmark}&`
} }
if (searchTerm) { if (emailSearch) {
url += `searchTerm=${searchTerm}&` url += `emailSearch=${emailSearch}&`
} }
return await API.get({ return await API.get({

View File

@ -31,7 +31,7 @@ export default class GroupUserFetch extends DataFetch {
try { try {
const res = await this.API.getGroupUsers({ const res = await this.API.getGroupUsers({
id: query.groupId, id: query.groupId,
searchTerm: query.searchTerm, emailSearch: query.emailSearch,
bookmark: cursor, bookmark: cursor,
}) })