Moving to matrix-js-sdk

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

View File

@@ -14,32 +14,34 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
import React, { useCallback, useRef } from "react";
import React, { useCallback, useRef, useState } from "react";
import { useHistory, useLocation, Link } from "react-router-dom";
import { Header, LeftNav } from "./Header";
import { FieldRow, InputField, Button, ErrorMessage } from "./Input";
import { Center, Content, Info, Modal } from "./Layout";
export function RegisterPage({ onRegister, error }) {
export function RegisterPage({ onRegister }) {
const registerUsernameRef = useRef();
const registerPasswordRef = useRef();
const history = useHistory();
const location = useLocation();
const [error, setError] = useState();
const onSubmitRegisterForm = useCallback(
(e) => {
e.preventDefault();
onRegister(
registerUsernameRef.current.value,
registerPasswordRef.current.value,
() => {
registerPasswordRef.current.value
)
.then(() => {
if (location.state && location.state.from) {
history.replace(location.state.from);
} else {
history.replace("/");
}
}
);
})
.catch(setError);
},
[onRegister, location, history]
);