mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 11:35:04 +01:00
Convert TokenLoginMethod to ts
This commit is contained in:
parent
e4c443c73a
commit
64037cb32a
@ -27,7 +27,7 @@ import {RequestScheduler} from "./net/RequestScheduler.js";
|
||||
import {Sync, SyncStatus} from "./Sync.js";
|
||||
import {Session} from "./Session.js";
|
||||
import {PasswordLoginMethod} from "./login/PasswordLoginMethod.js";
|
||||
import {TokenLoginMethod} from "./login/TokenLoginMethod.js";
|
||||
import {TokenLoginMethod} from "./login/TokenLoginMethod";
|
||||
import {SSOLoginHelper} from "./login/SSOLoginHelper.js";
|
||||
import {getDehydratedDevice} from "./e2ee/Dehydration.js";
|
||||
|
||||
|
@ -14,16 +14,21 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
import {LoginMethod} from "./LoginMethod";
|
||||
import {makeTxnId} from "../common.js";
|
||||
import {ILogItem} from "../../logging/types";
|
||||
import {ILoginMethod} from "./LoginMethod";
|
||||
import {HomeServerApi} from "../net/HomeServerApi.js";
|
||||
|
||||
export class TokenLoginMethod extends LoginMethod {
|
||||
constructor(options) {
|
||||
super(options);
|
||||
this._loginToken = options.loginToken;
|
||||
export class TokenLoginMethod implements ILoginMethod {
|
||||
public readonly homeserver: string;
|
||||
private readonly _loginToken: string;
|
||||
|
||||
constructor({ homeserver, loginToken }: { homeserver: string, loginToken: string}) {
|
||||
this.homeserver = homeserver;
|
||||
this._loginToken = loginToken;
|
||||
}
|
||||
|
||||
async login(hsApi, deviceName, log) {
|
||||
async login(hsApi: HomeServerApi, deviceName: string, log: ILogItem): Promise<Response["body"]> {
|
||||
return await hsApi.tokenLogin(this._loginToken, makeTxnId(), deviceName, {log}).response();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user