Skip to content

Commit

Permalink
Switched to uploadFile from axios in scribe
Browse files Browse the repository at this point in the history
  • Loading branch information
shivankacker committed Aug 20, 2024
1 parent 0e25ace commit e0840e2
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions src/Components/Scribe/Scribe.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import CareIcon from "../../CAREUI/icons/CareIcon";
import routes from "../../Redux/api";
import * as Notify from "../../Utils/Notifications";
import request from "../../Utils/request/request";
import axios from "axios";
import { UserModel } from "../Users/models";
import useConfig from "../../Common/hooks/useConfig";
import useSegmentedRecording from "../../Utils/useSegmentedRecorder";
import uploadFile from "../../Utils/request/uploadFile";

interface FieldOption {
id: string | number;
Expand Down Expand Up @@ -120,21 +120,20 @@ export const Scribe: React.FC<ScribeProps> = ({ form, onFormUpdate }) => {
return;
}
const newFile = new File([f], `${internal_name}`, { type: f.type });
const config = {
headers: {
"Content-type": newFile?.type?.split(";")?.[0],
"Content-disposition": "inline",
},
const headers = {
"Content-type": newFile?.type?.split(";")?.[0],
"Content-disposition": "inline",
};

axios
.put(url, newFile, config)
.then(() => {
resolve();
})
.catch((error) => {
reject(error);
});
uploadFile(
url,
newFile,
"PUT",
headers,
(xhr: XMLHttpRequest) => (xhr.status === 200 ? resolve() : reject()),
null,
reject,
);
});
};

Expand Down

0 comments on commit e0840e2

Please sign in to comment.