export async function usersFetcher()

in web/src/api/hooks/users.ts [24:54]


export async function usersFetcher(
    page = 1,
    size = pageSizes._15,
    search: string = '',
    filters: Array<FilterWithDocumentExtraOption<keyof User>> = []
): Promise<PagedResponse<User>> {
    const body = {
        filters: [...filters]
    };
    if (search) {
        // name is not in the model
        body.filters.push({ field: 'name', operator: Operators.LIKE, value: search } as never);
    }

    const data = await useBadgerFetch<Array<User>>({
        url: `${namespace}/users/search`,
        method: 'post',
        withCredentials: true
    })(JSON.stringify(body));

    return {
        data,
        pagination: {
            has_more: false,
            min_pages_left: 1,
            page_num: page,
            page_size: size,
            total: data.length
        }
    };
}