mirror of https://github.com/vector-im/riot-web
put state declaration on top
parent
50b64d8c55
commit
400cb33247
|
@ -32,7 +32,9 @@ const MISMATCHES = ["m.key_mismatch", "m.user_error", "m.mismatched_sas"];
|
||||||
|
|
||||||
const EncryptionPanel = ({verificationRequest, member, onClose, layout}) => {
|
const EncryptionPanel = ({verificationRequest, member, onClose, layout}) => {
|
||||||
const [request, setRequest] = useState(verificationRequest);
|
const [request, setRequest] = useState(verificationRequest);
|
||||||
|
// state to show a spinner immediately after clicking "start verification",
|
||||||
|
// before we have a request
|
||||||
|
const [isRequesting, setRequesting] = useState(false);
|
||||||
const [phase, setPhase] = useState(request && request.phase);
|
const [phase, setPhase] = useState(request && request.phase);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setRequest(verificationRequest);
|
setRequest(verificationRequest);
|
||||||
|
@ -68,9 +70,6 @@ const EncryptionPanel = ({verificationRequest, member, onClose, layout}) => {
|
||||||
}, [onClose, request]);
|
}, [onClose, request]);
|
||||||
useEventEmitter(request, "change", changeHandler);
|
useEventEmitter(request, "change", changeHandler);
|
||||||
|
|
||||||
// state to show a spinner immediately after clicking "start verification",
|
|
||||||
// before we have a request
|
|
||||||
const [isRequesting, setRequesting] = useState(false);
|
|
||||||
const onStartVerification = useCallback(async () => {
|
const onStartVerification = useCallback(async () => {
|
||||||
setRequesting(true);
|
setRequesting(true);
|
||||||
const cli = MatrixClientPeg.get();
|
const cli = MatrixClientPeg.get();
|
||||||
|
|
Loading…
Reference in New Issue