Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switched to uploadFile from axios in scribe #8379

Merged
merged 1 commit into from
Sep 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading