mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 03:25:12 +01:00
Make methods private + some props readonly
This commit is contained in:
parent
8a3c0afba6
commit
89a97537b0
@ -28,9 +28,9 @@ import type {
|
||||
type FlowSelector = (flows: RegistrationFlow[]) => RegistrationFlow | void;
|
||||
|
||||
export class Registration {
|
||||
private _hsApi: HomeServerApi;
|
||||
private _accountDetails: AccountDetails;
|
||||
private _flowSelector: FlowSelector;
|
||||
private readonly _hsApi: HomeServerApi;
|
||||
private readonly _accountDetails: AccountDetails;
|
||||
private readonly _flowSelector: FlowSelector;
|
||||
private _sessionInfo?: RegistrationResponseSuccess
|
||||
|
||||
constructor(hsApi: HomeServerApi, accountDetails: AccountDetails, flowSelector?: FlowSelector) {
|
||||
@ -64,7 +64,7 @@ export class Registration {
|
||||
return this.parseRegistrationResponse(registrationResponse, stage);
|
||||
}
|
||||
|
||||
parseStagesFromResponse(response: RegistrationResponseMoreDataNeeded): BaseRegistrationStage {
|
||||
private parseStagesFromResponse(response: RegistrationResponseMoreDataNeeded): BaseRegistrationStage {
|
||||
const { session, params } = response;
|
||||
const flow = this._flowSelector(response.flows);
|
||||
if (!flow) {
|
||||
@ -89,7 +89,7 @@ export class Registration {
|
||||
return firstStage!;
|
||||
}
|
||||
|
||||
async parseRegistrationResponse(response: RegistrationResponse, currentStage: BaseRegistrationStage) {
|
||||
private async parseRegistrationResponse(response: RegistrationResponse, currentStage: BaseRegistrationStage) {
|
||||
switch (response.status) {
|
||||
case 200:
|
||||
this._sessionInfo = response;
|
||||
|
@ -18,11 +18,11 @@ import type {HomeServerApi} from "../../net/HomeServerApi";
|
||||
import type {AccountDetails, AuthenticationData, RegistrationParams} from "../types";
|
||||
|
||||
export abstract class BaseRegistrationStage {
|
||||
protected _hsApi: HomeServerApi;
|
||||
protected _accountDetails: AccountDetails;
|
||||
protected readonly _hsApi: HomeServerApi;
|
||||
protected readonly _accountDetails: AccountDetails;
|
||||
protected _session: string;
|
||||
protected _nextStage: BaseRegistrationStage;
|
||||
protected _params?: Record<string, any>
|
||||
protected readonly _params?: Record<string, any>
|
||||
|
||||
constructor(hsApi: HomeServerApi, accountDetails: AccountDetails, session: string, params?: RegistrationParams) {
|
||||
this._hsApi = hsApi;
|
||||
|
Loading…
Reference in New Issue
Block a user