enh: add folder modal

This commit is contained in:
Timothy Jaeryang Baek
2025-07-19 19:46:35 +04:00
parent a638a187bb
commit 1159f3a781
5 changed files with 35 additions and 16 deletions
+7 -9
View File
@@ -1,6 +1,11 @@
import { WEBUI_API_BASE_URL } from '$lib/constants';
export const createNewFolder = async (token: string, name: string) => {
type FolderForm = {
name: string;
data?: Record<string, any>;
};
export const createNewFolder = async (token: string, folderForm: FolderForm) => {
let error = null;
const res = await fetch(`${WEBUI_API_BASE_URL}/folders/`, {
@@ -10,9 +15,7 @@ export const createNewFolder = async (token: string, name: string) => {
'Content-Type': 'application/json',
authorization: `Bearer ${token}`
},
body: JSON.stringify({
name: name
})
body: JSON.stringify(folderForm)
})
.then(async (res) => {
if (!res.ok) throw await res.json();
@@ -92,11 +95,6 @@ export const getFolderById = async (token: string, id: string) => {
return res;
};
type FolderForm = {
name: string;
data?: Record<string, any>;
};
export const updateFolderById = async (token: string, id: string, folderForm: FolderForm) => {
let error = null;