Moving to matrix-js-sdk
This commit is contained in:
parent
4d7e5583eb
commit
d813509541
13 changed files with 821 additions and 2519 deletions
|
|
@ -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]
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue