refac
This commit is contained in:
@@ -142,7 +142,8 @@ export const getChannelMembersById = async (
|
||||
query?: string,
|
||||
orderBy?: string,
|
||||
direction?: string,
|
||||
page = 1
|
||||
page = 1,
|
||||
signal?: AbortSignal
|
||||
) => {
|
||||
let error = null;
|
||||
let res = null;
|
||||
@@ -167,6 +168,7 @@ export const getChannelMembersById = async (
|
||||
`${WEBUI_API_BASE_URL}/channels/${channel_id}/members?${searchParams.toString()}`,
|
||||
{
|
||||
method: 'GET',
|
||||
signal,
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bearer ${token}`
|
||||
@@ -178,6 +180,7 @@ export const getChannelMembersById = async (
|
||||
return res.json();
|
||||
})
|
||||
.catch((err) => {
|
||||
if (signal?.aborted) return null;
|
||||
console.error(err);
|
||||
error = err.detail;
|
||||
return null;
|
||||
|
||||
@@ -198,7 +198,8 @@ export const searchUsers = async (
|
||||
query?: string,
|
||||
orderBy?: string,
|
||||
direction?: string,
|
||||
page = 1
|
||||
page = 1,
|
||||
signal?: AbortSignal
|
||||
) => {
|
||||
let error = null;
|
||||
let res = null;
|
||||
@@ -221,6 +222,7 @@ export const searchUsers = async (
|
||||
|
||||
res = await fetch(`${WEBUI_API_BASE_URL}/users/search?${searchParams.toString()}`, {
|
||||
method: 'GET',
|
||||
signal,
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bearer ${token}`
|
||||
@@ -231,6 +233,7 @@ export const searchUsers = async (
|
||||
return res.json();
|
||||
})
|
||||
.catch((err) => {
|
||||
if (signal?.aborted) return null;
|
||||
console.error(err);
|
||||
error = err.detail;
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user