This commit is contained in:
Timothy Jaeryang Baek
2026-04-01 00:55:52 -05:00
parent c6b1c56e9e
commit fe8a3d9f83
4 changed files with 202 additions and 42 deletions
+44
View File
@@ -77,6 +77,50 @@ export const getAutomations = async (token: string) => {
return res;
};
export const getAutomationItems = async (
token: string,
query: string | null,
status: string | null,
page: number
): Promise<{ items: AutomationResponse[]; total: number }> => {
let error = null;
const searchParams = new URLSearchParams();
if (query) {
searchParams.append('query', query);
}
if (status && status !== 'all') {
searchParams.append('status', status);
}
if (page) {
searchParams.append('page', page.toString());
}
const res = await fetch(`${WEBUI_API_BASE_URL}/automations/list?${searchParams.toString()}`, {
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();
})
.catch((err) => {
error = err.detail;
console.error(err);
return null;
});
if (error) {
throw error;
}
return res;
};
export const createAutomation = async (token: string, form: AutomationForm) => {
let error = null;