mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-22 19:14:52 +01:00
typescript-ifying StartSSOLoginViewModel
This commit is contained in:
parent
749e038a47
commit
53c4ecb69b
@ -17,7 +17,7 @@ limitations under the License.
|
||||
import {Client} from "../../matrix/Client.js";
|
||||
import {Options as BaseOptions, ViewModel} from "../ViewModel";
|
||||
import {PasswordLoginViewModel} from "./PasswordLoginViewModel";
|
||||
import {StartSSOLoginViewModel} from "./StartSSOLoginViewModel.js";
|
||||
import {StartSSOLoginViewModel} from "./StartSSOLoginViewModel";
|
||||
import {CompleteSSOLoginViewModel} from "./CompleteSSOLoginViewModel.js";
|
||||
import {LoadStatus} from "../../matrix/Client.js";
|
||||
import {SessionLoadViewModel} from "../SessionLoadViewModel.js";
|
||||
@ -64,7 +64,7 @@ export class LoginViewModel extends ViewModel<SegmentType, Options> {
|
||||
return this._passwordLoginViewModel;
|
||||
}
|
||||
|
||||
get startSSOLoginViewModel(): StartSSOLoginViewModel {
|
||||
get startSSOLoginViewModel(): StartSSOLoginViewModel | undefined {
|
||||
return this._startSSOLoginViewModel;
|
||||
}
|
||||
|
||||
|
@ -14,25 +14,35 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
import {ViewModel} from "../ViewModel";
|
||||
import type {SSOLoginHelper} from "../../matrix/login";
|
||||
import {Options as BaseOptions, ViewModel} from "../ViewModel";
|
||||
import type {LoginOptions} from "./LoginViewModel";
|
||||
|
||||
|
||||
type Options = {
|
||||
loginOptions: LoginOptions | undefined;
|
||||
} & BaseOptions;
|
||||
|
||||
export class StartSSOLoginViewModel extends ViewModel{
|
||||
constructor(options) {
|
||||
private _sso?: SSOLoginHelper;
|
||||
private _isBusy = false;
|
||||
|
||||
constructor(options: Options) {
|
||||
super(options);
|
||||
this._sso = options.loginOptions.sso;
|
||||
this._sso = options.loginOptions!.sso;
|
||||
this._isBusy = false;
|
||||
}
|
||||
|
||||
get isBusy() { return this._isBusy; }
|
||||
|
||||
setBusy(status) {
|
||||
|
||||
get isBusy(): boolean { return this._isBusy; }
|
||||
|
||||
setBusy(status: boolean): void {
|
||||
this._isBusy = status;
|
||||
this.emitChange("isBusy");
|
||||
}
|
||||
|
||||
async startSSOLogin() {
|
||||
await this.platform.settingsStorage.setString("sso_ongoing_login_homeserver", this._sso.homeserver);
|
||||
const link = this._sso.createSSORedirectURL(this.urlCreator.createSSOCallbackURL());
|
||||
async startSSOLogin(): Promise<void> {
|
||||
await this.platform.settingsStorage.setString("sso_ongoing_login_homeserver", this._sso!.homeserver);
|
||||
const link = this._sso!.createSSORedirectURL(this.urlCreator.createSSOCallbackURL());
|
||||
this.platform.openUrl(link);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user