refac
This commit is contained in:
1 parent
f7406ff576
commit
3c7f9aa6a4
27 files changed
+789
-253
No files matched your search
@@ -99,6 +99,38 @@ export const getGroupById = async (token: string, id: string) => {
|
||||
return res;
|
||||
};
|
||||
|
||||
export const getGroupInfoById = async (token: string, id: string) => {
|
||||
let error = null;
|
||||
|
||||
const res = await fetch(`${WEBUI_API_BASE_URL}/groups/id/${id}/info`, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
authorization: `Bearer ${token}`
|
||||
}
|
||||
})
|
||||
.then(async (res) => {
|
||||
if (!res.ok) throw await res.json();
|
||||
return res.json();
|
||||
})
|
||||
.then((json) => {
|
||||
return json;
|
||||
})
|
||||
.catch((err) => {
|
||||
error = err.detail;
|
||||
|
||||
console.error(err);
|
||||
return null;
|
||||
});
|
||||
|
||||
if (error) {
|
||||
throw error;
|
||||
}
|
||||
|
||||
return res;
|
||||
};
|
||||
|
||||
export const updateGroupById = async (token: string, id: string, group: object) => {
|
||||
let error = null;
|
||||
|
||||
|
||||
Reference in new issue
Block a user