diff --git a/components/HiddenInfo/gwj/index.js b/components/HiddenInfo/gwj/index.js index 0a3e661..5873f65 100644 --- a/components/HiddenInfo/gwj/index.js +++ b/components/HiddenInfo/gwj/index.js @@ -46,13 +46,7 @@ function HiddenInfo(props) { const query = useGetUrlQuery(); const { loading: downloadFileLoading, downloadFile } = useDownloadFile(); - const getData = async () => { - request(`/hidden/hidden/${id || query[idKey]}`, "get").then((res) => { - setInfo(res.data); - setLoading(false); - onGetData?.(res.data); - }); - + const getFileData = async (info) => { const hiddenImageFiles = await getFile({ eqType: UPLOAD_FILE_TYPE_ENUM["3"], eqForeignKey: hiddenId || query[hiddenIdKey] }); setHiddenImageFiles(hiddenImageFiles); const hiddenVideoFiles = await getFile({ eqType: UPLOAD_FILE_TYPE_ENUM["102"], eqForeignKey: hiddenId || query[hiddenIdKey] }); @@ -78,6 +72,15 @@ function HiddenInfo(props) { const acceptImageFiles = await getFile({ eqType: UPLOAD_FILE_TYPE_ENUM["5"], eqForeignKey: hiddenId || query[hiddenIdKey] }); setAcceptImageFiles(acceptImageFiles); } + } + + const getData = async () => { + request(`/hidden/hidden/${id || query[idKey]}`, "get").then((res) => { + setInfo(res.data); + getFileData(res.data); + setLoading(false); + onGetData?.(res.data); + }); }; useEffect(() => { getData();