From c4ea56ce91078efc04264210d90a435e35997f9a Mon Sep 17 00:00:00 2001 From: rithviknishad Date: Wed, 14 Feb 2024 19:24:01 +0530 Subject: [PATCH] fetch on mount --- src/Components/Patient/FileUpload.tsx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Components/Patient/FileUpload.tsx b/src/Components/Patient/FileUpload.tsx index 814f4717448..6f9ca63d51b 100644 --- a/src/Components/Patient/FileUpload.tsx +++ b/src/Components/Patient/FileUpload.tsx @@ -1,6 +1,13 @@ import axios from "axios"; import CircularProgress from "../Common/components/CircularProgress"; -import { useCallback, useState, useRef, lazy, ChangeEvent } from "react"; +import { + useCallback, + useState, + useRef, + lazy, + ChangeEvent, + useEffect, +} from "react"; import { CreateFileResponse, FileUploadModel } from "./models"; import * as Notification from "../../Utils/Notifications.js"; import { VoiceRecorder } from "../../Utils/VoiceRecorder"; @@ -334,6 +341,10 @@ export const FileUpload = (props: FileUploadProps) => { setIsLoading(false); }, [id, offset]); + useEffect(() => { + fetchData(); + }, [fetchData]); + // Store all audio urls for each audio file const audio_urls = async (files: FileUploadModel[]) => { const audioFiles = files.filter((x) => x.file_category === "AUDIO");