mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 11:35:04 +01:00
Give default values to parameters
This commit is contained in:
parent
755f934eb2
commit
e8dbbd876c
@ -156,22 +156,19 @@ export class HomeServerApi {
|
|||||||
return this._unauthedRequest("GET", this._url("/login"));
|
return this._unauthedRequest("GET", this._url("/login"));
|
||||||
}
|
}
|
||||||
|
|
||||||
register(username: string | null, password: string, initialDeviceDisplayName: string, auth?: Record<string, any>, inhibitLogin?: boolean , options?: IRequestOptions): IHomeServerRequest {
|
register(username: string | null, password: string, initialDeviceDisplayName: string, auth?: Record<string, any>, inhibitLogin: boolean = true , options: IRequestOptions = {}): IHomeServerRequest {
|
||||||
// todo: This is so that we disable cache-buster because it would cause the hs to respond with error
|
Object.assign(options, { allowedErrors: [401] });
|
||||||
// see https://github.com/matrix-org/synapse/issues/7722
|
|
||||||
const _options = options ?? {};
|
|
||||||
Object.assign(_options, { allowedErrors: [401] });
|
|
||||||
const body = {
|
const body = {
|
||||||
auth,
|
auth,
|
||||||
password,
|
password,
|
||||||
initial_device_displayname: initialDeviceDisplayName,
|
initial_device_displayname: initialDeviceDisplayName,
|
||||||
inhibit_login: inhibitLogin ?? false,
|
inhibit_login: inhibitLogin,
|
||||||
};
|
};
|
||||||
if (username) {
|
if (username) {
|
||||||
// username is optional for registration
|
// username is optional for registration
|
||||||
Object.assign(body, { username });
|
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 {
|
passwordLogin(username: string, password: string, initialDeviceDisplayName: string, options?: IRequestOptions): IHomeServerRequest {
|
||||||
|
Loading…
Reference in New Issue
Block a user