enh: add folder modal
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user