enh: drag and drop folders

This commit is contained in:
Timothy J. Baek
2024-10-16 23:06:53 -07:00
parent d5bf32f240
commit 36a541d6b0
5 changed files with 104 additions and 9 deletions
+34 -1
View File
@@ -164,10 +164,43 @@ export const updateFolderIsExpandedById = async (
return res;
};
export const updateFolderParentIdById = async (token: string, id: string, parentId?: string) => {
let error = null;
const res = await fetch(`${WEBUI_API_BASE_URL}/folders/${id}/update/parent`, {
method: 'POST',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
authorization: `Bearer ${token}`
},
body: JSON.stringify({
parent_id: parentId
})
})
.then(async (res) => {
if (!res.ok) throw await res.json();
return res.json();
})
.then((json) => {
return json;
})
.catch((err) => {
error = err.detail;
console.log(err);
return null;
});
if (error) {
throw error;
}
return res;
};
type FolderItems = {
chat_ids: string[];
file_ids: string[];
folder_ids: string[];
};
export const updateFolderItemsById = async (token: string, id: string, items: FolderItems) => {