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

View File

@ -55,13 +55,13 @@ export const buildGroupsEndpoints = API => {
/**
* 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?`
if (bookmark) {
url += `bookmark=${bookmark}&`
}
if (searchTerm) {
url += `searchTerm=${searchTerm}&`
if (emailSearch) {
url += `emailSearch=${emailSearch}&`
}
return await API.get({

View File

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