Convert Registration to TS

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
Šimon Brandner 2021-09-27 12:47:47 +02:00
parent 30599554f1
commit a680b5f968
No known key found for this signature in database
GPG key ID: 55C211A1226CB17D

View file

@ -20,10 +20,11 @@ limitations under the License.
* registration code. * registration code.
*/ */
import React from "react";
import dis from './dispatcher/dispatcher'; import dis from './dispatcher/dispatcher';
import * as sdk from './index';
import Modal from './Modal'; import Modal from './Modal';
import { _t } from './languageHandler'; import { _t } from './languageHandler';
import QuestionDialog from "./components/views/dialogs/QuestionDialog";
// Regex for what a "safe" or "Matrix-looking" localpart would be. // Regex for what a "safe" or "Matrix-looking" localpart would be.
// TODO: Update as needed for https://github.com/matrix-org/matrix-doc/issues/1514 // TODO: Update as needed for https://github.com/matrix-org/matrix-doc/issues/1514
@ -41,9 +42,11 @@ export const SAFE_LOCALPART_REGEX = /^[a-z0-9=_\-./]+$/;
* @param {bool} options.screen_after * @param {bool} options.screen_after
* If present the screen to redirect to after a successful login or register. * If present the screen to redirect to after a successful login or register.
*/ */
export async function startAnyRegistrationFlow(options) { export async function startAnyRegistrationFlow(
// eslint-disable-next-line camelcase
options: { go_home_on_cancel?: boolean, go_welcome_on_cancel?: boolean, screen_after?: boolean},
): Promise<void> {
if (options === undefined) options = {}; if (options === undefined) options = {};
const QuestionDialog = sdk.getComponent("dialogs.QuestionDialog");
const modal = Modal.createTrackedDialog('Registration required', '', QuestionDialog, { const modal = Modal.createTrackedDialog('Registration required', '', QuestionDialog, {
hasCancelButton: true, hasCancelButton: true,
quitOnly: true, quitOnly: true,