mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2025-01-11 04:27:40 +01:00
Convert PasswordLoginMethod to ts
This commit is contained in:
parent
91f2a96403
commit
e4c443c73a
@ -19,5 +19,5 @@ import type {HomeServerApi} from "../net/HomeServerApi.js";
|
|||||||
|
|
||||||
export interface ILoginMethod {
|
export interface ILoginMethod {
|
||||||
homeserver: string;
|
homeserver: string;
|
||||||
login(hsApi: HomeServerApi, deviceName: string, log: ILogItem): Response["body"];
|
login(hsApi: HomeServerApi, deviceName: string, log: ILogItem): Promise<Response["body"]>;
|
||||||
}
|
}
|
||||||
|
@ -14,16 +14,22 @@ See the License for the specific language governing permissions and
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {LoginMethod} from "./LoginMethod";
|
import {ILogItem} from "../../logging/types";
|
||||||
|
import {ILoginMethod} from "./LoginMethod";
|
||||||
|
import {HomeServerApi} from "../net/HomeServerApi.js";
|
||||||
|
|
||||||
export class PasswordLoginMethod extends LoginMethod {
|
export class PasswordLoginMethod implements ILoginMethod {
|
||||||
constructor(options) {
|
public username: string;
|
||||||
super(options);
|
public password: string;
|
||||||
this.username = options.username;
|
public homeserver: string;
|
||||||
this.password = options.password;
|
|
||||||
|
constructor({username, password, homeserver}: {username: string, password: string, homeserver: string}) {
|
||||||
|
this.username = username;
|
||||||
|
this.password = password;
|
||||||
|
this.homeserver = homeserver;
|
||||||
}
|
}
|
||||||
|
|
||||||
async login(hsApi, deviceName, log) {
|
async login(hsApi: HomeServerApi, deviceName: string, log: ILogItem) {
|
||||||
return await hsApi.passwordLogin(this.username, this.password, deviceName, {log}).response();
|
return await hsApi.passwordLogin(this.username, this.password, deviceName, {log}).response();
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user