Skip to content

Commit 35fadb7

Browse files
committed
Load Mods from Save requires factorio mod portal login
1 parent 299b33e commit 35fadb7

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

ui/App/views/Mods/components/LoadMods.jsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,21 @@ import Label from "../../../components/Label";
55
import {useForm} from "react-hook-form";
66
import Button from "../../../components/Button";
77
import modsResource from "../../../../api/resources/mods";
8+
import modResource from "../../../../api/resources/mods";
9+
import FactorioLogin from "./AddMod/components/FactorioLogin";
810

911
const LoadMods = ({refreshMods}) => {
1012

1113
const [saves, setSaves] = useState([]);
1214
const {register, reset, handleSubmit} = useForm();
1315
const [isLoading, setIsLoading] = useState(false);
1416
const [isDisabled, setIsDisabled] = useState(true);
17+
const [isFactorioAuthenticated, setIsFactorioAuthenticated] = useState(false);
1518

1619
useEffect(() => {
1720
(async () => {
21+
setIsFactorioAuthenticated(await modResource.portal.status())
22+
1823
const s = await savesResource.list()
1924
setSaves(s);
2025
if (s.length > 0) {
@@ -39,8 +44,8 @@ const LoadMods = ({refreshMods}) => {
3944
.catch(() => setIsLoading(false))
4045
}
4146

42-
return (
43-
<form onSubmit={handleSubmit(loadMods)}>
47+
return isFactorioAuthenticated
48+
? <form onSubmit={handleSubmit(loadMods)}>
4449
<Label text="Save" htmlFor="save"/>
4550
<Select
4651
register={register('save')}
@@ -53,7 +58,7 @@ const LoadMods = ({refreshMods}) => {
5358
/>
5459
<Button isSubmit={true} isDisabled={isDisabled} isLoading={isLoading}>Load</Button>
5560
</form>
56-
)
61+
: <FactorioLogin setIsFactorioAuthenticated={setIsFactorioAuthenticated}/>
5762
}
5863

5964
export default LoadMods;

0 commit comments

Comments
 (0)