Combine session status events into one event

This commit is contained in:
Mitchell McCaffrey
2021-02-20 14:40:00 +11:00
parent 0a12361b16
commit 77bb13e8e6
4 changed files with 44 additions and 86 deletions
+4 -6
View File
@@ -5,8 +5,8 @@ import { useAuth } from "../contexts/AuthContext";
import Modal from "../components/Modal";
function AuthModal({ isOpen }) {
const { password, setPassword, setAuthenticationStatus } = useAuth();
function AuthModal({ isOpen, onSubmit }) {
const { password, setPassword } = useAuth();
const [tmpPassword, setTempPassword] = useState(password);
function handleChange(event) {
@@ -15,8 +15,8 @@ function AuthModal({ isOpen }) {
function handleSubmit(event) {
event.preventDefault();
setAuthenticationStatus("unknown");
setPassword(tmpPassword);
onSubmit(tmpPassword);
}
const inputRef = useRef();
@@ -38,9 +38,7 @@ function AuthModal({ isOpen }) {
autoComplete="off"
/>
<Flex py={2}>
<Button sx={{ flexGrow: 1 }} disabled={!tmpPassword}>
Join
</Button>
<Button sx={{ flexGrow: 1 }}>Join</Button>
</Flex>
</Box>
</Modal>