Moving to matrix-js-sdk

This commit is contained in:
Robert Long 2021-09-10 12:20:17 -07:00
commit d813509541
13 changed files with 821 additions and 2519 deletions

View file

@ -20,26 +20,25 @@ import { Header, LeftNav } from "./Header";
import { FieldRow, InputField, Button, ErrorMessage } from "./Input";
import { Center, Content, Info, Modal } from "./Layout";
export function LoginPage({ onLogin, error }) {
export function LoginPage({ onLogin }) {
const loginUsernameRef = useRef();
const loginPasswordRef = useRef();
const history = useHistory();
const location = useLocation();
const [error, setError] = useState();
const onSubmitLoginForm = useCallback(
(e) => {
e.preventDefault();
onLogin(
loginUsernameRef.current.value,
loginPasswordRef.current.value,
() => {
onLogin(loginUsernameRef.current.value, loginPasswordRef.current.value)
.then(() => {
if (location.state && location.state.from) {
history.replace(location.state.from);
} else {
history.replace("/");
}
}
);
})
.catch(setError);
},
[onLogin, location, history]
);