refactor: changed selectedPath from an object to a string

This commit is contained in:
shadowtosser 2024-04-20 23:02:30 -03:00
parent 41f7e5016d
commit 1c0810b976

View File

@ -23,9 +23,7 @@ export function SelectFolderModal({
}: SelectFolderModalProps) { }: SelectFolderModalProps) {
const { t } = useTranslation("game_details"); const { t } = useTranslation("game_details");
const [selectedPath, setSelectedPath] = useState({ const [selectedPath, setSelectedPath] = useState(null);
downloadsPath: "",
});
const [downloadStarting, setDownloadStarting] = useState(false); const [downloadStarting, setDownloadStarting] = useState(false);
useEffect(() => { useEffect(() => {
@ -33,9 +31,7 @@ export function SelectFolderModal({
window.electron.getDefaultDownloadsPath(), window.electron.getDefaultDownloadsPath(),
window.electron.getUserPreferences(), window.electron.getUserPreferences(),
]).then(([path, userPreferences]) => { ]).then(([path, userPreferences]) => {
setSelectedPath({ setSelectedPath(userPreferences?.downloadsPath || path);
downloadsPath: userPreferences?.downloadsPath || path,
});
}); });
}, []); }, []);
@ -47,7 +43,7 @@ export function SelectFolderModal({
if (filePaths && filePaths.length > 0) { if (filePaths && filePaths.length > 0) {
const path = filePaths[0]; const path = filePaths[0];
setSelectedPath({ downloadsPath: path }); setSelectedPath(path);
} }
}; };