added comments

added comments
This commit is contained in:
xrando 2023-11-01 12:24:38 +08:00
parent 316d438fa8
commit 95582e71a0
1 changed files with 6 additions and 6 deletions

View File

@ -13,7 +13,7 @@ const customStyles = {
transform: 'translate(-50%, -50%)', transform: 'translate(-50%, -50%)',
}, },
}; };
// Download function
function DownloadFile() { function DownloadFile() {
const [passcode, setPasscode] = useState(''); const [passcode, setPasscode] = useState('');
const [fileData, setFileData] = useState(null); const [fileData, setFileData] = useState(null);
@ -23,24 +23,24 @@ function DownloadFile() {
const apiUrl = process.env.REACT_APP_API_HOST || 'localhost:8000'; const apiUrl = process.env.REACT_APP_API_HOST || 'localhost:8000';
console.log(apiUrl); console.log(apiUrl);
// Function to open modal
function openModal() { function openModal() {
setIsOpen(true); setIsOpen(true);
} }
// Function to apply styles to modal
function afterOpenModal() { function afterOpenModal() {
// references are now sync'd and can be accessed. // references are now sync'd and can be accessed.
subtitle.style.color = '#f00'; subtitle.style.color = '#f00';
} }
// Function to close modal
function closeModal() { function closeModal() {
setIsOpen(false); setIsOpen(false);
} }
// Function to handle passcode change
const handlePasscodeChange = (e) => { const handlePasscodeChange = (e) => {
setPasscode(e.target.value); setPasscode(e.target.value);
}; };
// Function to handle download file
const handleDownloadFile = () => { const handleDownloadFile = () => {
if (passcode) { if (passcode) {
axios.get(`${apiUrl}/api/files/${passcode}/`, {responseType: 'blob'}) axios.get(`${apiUrl}/api/files/${passcode}/`, {responseType: 'blob'})