🔨 refactor(inputFileComponent): remove unused flows and tabIndex variables, use tabId instead

The flows and tabIndex variables were not being used in the component, so they were removed. The tabId variable from the TabsContext is now being used instead to upload the file to the correct tab.
This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-06-21 13:42:52 -03:00
commit 59deed4009

View file

@ -17,8 +17,7 @@ export default function InputFileComponent({
}: FileComponentType) {
const [myValue, setMyValue] = useState(value);
const { setErrorData } = useContext(alertContext);
const { flows, tabIndex } = useContext(TabsContext);
const { id } = flows[tabIndex];
const { tabId } = useContext(TabsContext);
useEffect(() => {
if (disabled) {
setMyValue("");
@ -55,7 +54,7 @@ export default function InputFileComponent({
// Check if the file type is correct
if (file && checkFileType(file.name)) {
// Upload the file
uploadFile(file, id)
uploadFile(file, tabId)
.then((res) => res.data)
.then((data) => {
console.log("File uploaded successfully");