mirror of
https://github.com/StanGirard/quivr.git
synced 2025-01-08 12:19:24 +03:00
20 lines
516 B
TypeScript
20 lines
516 B
TypeScript
|
import { AxiosInstance } from "axios";
|
||
|
import { UUID } from "crypto";
|
||
|
|
||
|
import { ToastData } from "@/lib/components/ui/Toast/domain/types";
|
||
|
|
||
|
export type UploadResponse = {
|
||
|
data: { type: ToastData["variant"]; message: ToastData["text"] };
|
||
|
};
|
||
|
|
||
|
export type UploadInputProps = {
|
||
|
brainId: UUID;
|
||
|
formData: FormData;
|
||
|
};
|
||
|
|
||
|
export const uploadFile = async (
|
||
|
props: UploadInputProps,
|
||
|
axiosInstance: AxiosInstance
|
||
|
): Promise<UploadResponse> =>
|
||
|
axiosInstance.post(`/upload?brain_id=${props.brainId}`, props.formData);
|