import { rcloneSubPath, RCloneEndPoints } from "../constants"; const baseUrl: string = `${window.location.protocol}//${window.location.hostname}:${location.port}/${rcloneSubPath}`; const baseOptions: RequestInit = { method: "POST", headers: new Headers({ "content-type": "application/json" }), }; const fetchRClone = async (endpoint: RCloneEndPoints, options: RequestInit) => { options = { ...baseOptions, ...options }; return await fetch(`${baseUrl}/${endpoint}`, options); }; export default fetchRClone;