From e8dbbd876cf2ccb4b40c75b7a441dc972de5d1fb Mon Sep 17 00:00:00 2001 From: RMidhunSuresh Date: Tue, 1 Feb 2022 17:45:14 +0530 Subject: [PATCH] Give default values to parameters --- src/matrix/net/HomeServerApi.ts | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/matrix/net/HomeServerApi.ts b/src/matrix/net/HomeServerApi.ts index 45e8a56c..e5071b87 100644 --- a/src/matrix/net/HomeServerApi.ts +++ b/src/matrix/net/HomeServerApi.ts @@ -156,22 +156,19 @@ export class HomeServerApi { return this._unauthedRequest("GET", this._url("/login")); } - register(username: string | null, password: string, initialDeviceDisplayName: string, auth?: Record, inhibitLogin?: boolean , options?: IRequestOptions): IHomeServerRequest { - // todo: This is so that we disable cache-buster because it would cause the hs to respond with error - // see https://github.com/matrix-org/synapse/issues/7722 - const _options = options ?? {}; - Object.assign(_options, { allowedErrors: [401] }); + register(username: string | null, password: string, initialDeviceDisplayName: string, auth?: Record, inhibitLogin: boolean = true , options: IRequestOptions = {}): IHomeServerRequest { + Object.assign(options, { allowedErrors: [401] }); const body = { auth, password, initial_device_displayname: initialDeviceDisplayName, - inhibit_login: inhibitLogin ?? false, + inhibit_login: inhibitLogin, }; if (username) { // username is optional for registration Object.assign(body, { username }); } - return this._unauthedRequest( "POST", this._url("/register", CS_V3_PREFIX), undefined, body, _options); + return this._unauthedRequest( "POST", this._url("/register", CS_V3_PREFIX), undefined, body, options); } passwordLogin(username: string, password: string, initialDeviceDisplayName: string, options?: IRequestOptions): IHomeServerRequest {