fastapi-rtk
Version:
A React component library for FastAPI in combination with FastAPI React Toolkit backend, built with Mantine, JsonForms, and Zustand.
27 lines (26 loc) • 757 B
JavaScript
;
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const utils = require("fastapi-rtk/utils");
const uploadItems = async (path, file, { delimiter, quotechar } = {}) => {
const formData = new FormData();
formData.append("file", file);
const queryParams = {};
if (delimiter) {
queryParams.delimiter = delimiter;
}
if (quotechar) {
queryParams.quotechar = quotechar;
}
const { fetchPath, options } = utils.createFetchParams({
path: utils.urlJoin(path, "/upload"),
method: "POST",
queryParams
});
const response = await fetch(fetchPath, {
...options,
headers: void 0,
body: formData
});
return await utils.parseResponse(response);
};
exports.uploadItems = uploadItems;