mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 03:25:12 +01:00
Add method to query login types
Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
This commit is contained in:
parent
1e05d41294
commit
e0fcec9102
@ -49,6 +49,7 @@ export class LoginViewModel extends ViewModel {
|
|||||||
this._loadViewModel = this.track(new SessionLoadViewModel(this.childOptions({
|
this._loadViewModel = this.track(new SessionLoadViewModel(this.childOptions({
|
||||||
createAndStartSessionContainer: () => {
|
createAndStartSessionContainer: () => {
|
||||||
this._sessionContainer = this._createSessionContainer();
|
this._sessionContainer = this._createSessionContainer();
|
||||||
|
this._sessionContainer.queryLogin(homeserver);
|
||||||
this._sessionContainer.startWithLogin(homeserver, username, password);
|
this._sessionContainer.startWithLogin(homeserver, username, password);
|
||||||
return this._sessionContainer;
|
return this._sessionContainer;
|
||||||
},
|
},
|
||||||
|
@ -97,6 +97,12 @@ export class SessionContainer {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async queryLogin(homeServer) {
|
||||||
|
homeServer = normalizeHomeserver(homeServer);
|
||||||
|
const hsApi = new HomeServerApi({homeServer, request: this._platform.request});
|
||||||
|
const response = hsApi.queryLogin();
|
||||||
|
}
|
||||||
|
|
||||||
async startWithLogin(homeServer, username, password) {
|
async startWithLogin(homeServer, username, password) {
|
||||||
if (this._status.get() !== LoadStatus.NotLoading) {
|
if (this._status.get() !== LoadStatus.NotLoading) {
|
||||||
return;
|
return;
|
||||||
|
@ -134,6 +134,10 @@ export class HomeServerApi {
|
|||||||
return this._get(`/rooms/${encodeURIComponent(roomId)}/state/${encodeURIComponent(eventType)}/${encodeURIComponent(stateKey)}`, {}, null, options);
|
return this._get(`/rooms/${encodeURIComponent(roomId)}/state/${encodeURIComponent(eventType)}/${encodeURIComponent(stateKey)}`, {}, null, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
queryLogin() {
|
||||||
|
return this._unauthedRequest("GET", this._url("/login"), null, null, null);
|
||||||
|
}
|
||||||
|
|
||||||
passwordLogin(username, password, initialDeviceDisplayName, options = null) {
|
passwordLogin(username, password, initialDeviceDisplayName, options = null) {
|
||||||
return this._unauthedRequest("POST", this._url("/login"), null, {
|
return this._unauthedRequest("POST", this._url("/login"), null, {
|
||||||
"type": "m.login.password",
|
"type": "m.login.password",
|
||||||
|
Loading…
Reference in New Issue
Block a user